practicekea_backend/microservices/teacher/Validators/StudyNoteValidator.cs

59 lines
1.4 KiB
C#
Raw Permalink Normal View History

2024-12-02 13:24:34 +00:00
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);
}
}
}