59 lines
1.4 KiB
C#
59 lines
1.4 KiB
C#
|
|
using FluentValidation;
|
|||
|
|
using OnlineAssessment.Domain.ViewModels;
|
|||
|
|
|
|||
|
|
namespace OnlineAssessment.Validators
|
|||
|
|
{
|
|||
|
|
public class StudyNoteAddModelValidator : AbstractValidator<StudyNoteAddModel>
|
|||
|
|
{
|
|||
|
|
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<StudyNoteEditModel>
|
|||
|
|
{
|
|||
|
|
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);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|