public AddTeacherRequestValidator(IRelatedEntitiesValidator validator) { RuleFor(x => x.Firstname).NotEmpty().MaximumLength(45); RuleFor(x => x.Lastname).NotEmpty().MaximumLength(45); RuleFor(x => x.SchoolId).NotEmpty().GreaterThan(0) .MustAsync(validator.SchoolExists).WithMessage("School must exist in the database"); }
public AddSchoolRequestValidator(IRelatedEntitiesValidator validator) { RuleFor(x => x.Country).NotEmpty().MaximumLength(45); RuleFor(x => x.Name).NotEmpty().MaximumLength(45); RuleForEach(x => x.TeacherIds).GreaterThan(0) .MustAsync(validator.TeacherExists).WithMessage("All teachers must exist in the database"); }
public AddCourseRequestValidator(IRelatedEntitiesValidator validator) { RuleFor(x => x.Name).NotEmpty().MaximumLength(45); RuleFor(x => x.SeasonId).NotEmpty().GreaterThan(0); RuleFor(x => x.TeacherId).NotEmpty().GreaterThan(0) .MustAsync(validator.TeacherExists).WithMessage("Teacher must exist in the database"); }
public AddTeacherToSchoolRequestValidator(IRelatedEntitiesValidator validator) { RuleFor(x => x.SchoolId).NotEmpty().GreaterThan(0) .MustAsync(validator.SchoolExists).WithMessage("School must exist in the database"); RuleFor(x => x.TeacherId).NotEmpty().GreaterThan(0) .MustAsync(validator.TeacherExists).WithMessage("Teacher must exist in the database"); }
public AddPupilToClassRequestValidator(IRelatedEntitiesValidator validator) { RuleFor(x => x.ClassId).NotEmpty().GreaterThan(0); RuleFor(x => x.PupilId).NotEmpty().GreaterThan(0) .MustAsync(validator.PupilExists).WithMessage("Pupil must exist in the database"); RuleFor(x => x.TeacherId).NotEmpty().GreaterThan(0) .MustAsync(validator.TeacherExists).WithMessage("Teacher must exist in the database"); }