using FluentValidation; using OnlineAssessment.Domain.ViewModels; namespace OnlineAssessment.Validators { public class StudyNoteAddModelValidator : AbstractValidator { public StudyNoteAddModelValidator() { RuleFor(c => c.SubjectId) .NotEmpty() .NotNull() .GreaterThan(0); //RuleFor(c => c.LanguageId) // .NotEmpty() // .NotNull() // .GreaterThan(0); RuleFor(c => c.Name) .NotEmpty() .NotNull() .MaximumLength(500); RuleFor(c => c.Description).Length(0, 1500); } } public class StudyNoteEditModelValidator : AbstractValidator { public StudyNoteEditModelValidator() { RuleFor(c => c.Id) .NotEmpty() .NotNull() .GreaterThan(0); RuleFor(c => c.SubjectId) .NotEmpty() .NotNull() .GreaterThan(0); //RuleFor(c => c.LanguageId) // .NotEmpty() // .NotNull() // .GreaterThan(0); RuleFor(c => c.Name) .NotEmpty() .NotNull() .MaximumLength(500); RuleFor(c => c.Description).Length(0, 1500); } } }