public StudentCoursesController(CourseCodesContext context, IMapper mapper) { _context = context ?? throw new System.ArgumentNullException(nameof(context)); _mapper = mapper ?? throw new System.ArgumentNullException(nameof(mapper)); }
public CourseCreateRequestValidator(CourseCodesContext context) { RuleFor(x => x.InstructorId).NotEmpty(); RuleFor(x => x.CourseName).NotEmpty().MaximumLength(100); RuleFor(x => x.Term).NotEmpty().MaximumLength(20); RuleFor(x => x.Section).NotEmpty().MaximumLength(10); RuleFor(x => x.Capacity).GreaterThan(0); }
public CodeRunnersController(CourseCodesContext context, IMapper mapper, ICodeExecutionService codeExecutionService) { _context = context ?? throw new System.ArgumentNullException(nameof(context)); _mapper = mapper ?? throw new System.ArgumentNullException(nameof(mapper)); _codeExecutionService = codeExecutionService ?? throw new System.ArgumentNullException(nameof(codeExecutionService)); }
public AccountCreateRequestValidator(CourseCodesContext context) { RuleFor(x => x.FirstName).NotEmpty().MaximumLength(50); RuleFor(x => x.LastName).NotEmpty().MaximumLength(50); RuleFor(x => x.PasswordHash).NotEmpty().MaximumLength(100); RuleFor(x => x.AccountRole).NotEmpty().IsInEnum(); RuleFor(x => x.Email).NotEmpty().MaximumLength(255) .EmailAddress() .MustAsync(async(email, cancel) => { return(!(await context.Accounts.AnyAsync(a => a.Email == email))); }) .WithMessage("Email Address is already taken"); }
public StudentCourseCreateRequestValidator(CourseCodesContext context) { RuleFor(x => x.StudentId).NotEmpty(); RuleFor(x => x.CourseId).NotEmpty(); RuleFor(x => x.Code).NotEmpty().Length(6).WithMessage("Code is invalid"); }