public CommentValidator(TaskItemsDbContext context) { RuleFor(x => x.Id).NotNull(); RuleFor(x => x.Text) .NotEmpty() .WithMessage("Text cannot be empty."); RuleFor(x => x.Text) .Length(1, 100) .WithMessage("Text can't overpass 100 characters."); RuleFor(x => x.Important) .NotEmpty() .WithMessage("You must select the importance of this comment"); }
public TaskItemValidator(TaskItemsDbContext context) { RuleFor(x => x.Id).NotNull(); RuleFor(x => x.Title) .NotEmpty() .WithMessage("Title cannot be empty"); RuleFor(x => x.DateAdded) .LessThan(DateTime.Now) .WithMessage("Date added for a task can't be greater than current date."); RuleFor(x => x.Description) .Length(1, 60) .WithMessage("Description can't be overpass 60 characters."); }
//Constructor requires context in order to instantiate TaskItemController. public TaskItemController(TaskItemsDbContext context) { _context = context; }
public CommentsController(TaskItemsDbContext context) { _context = context; }