public CreateEventCommandValidator(CleanCodeContext dbContext) { _dbContext = dbContext; RuleFor(x => x.Name) .NotEmpty().WithMessage("{PropertyName} is required") .NotNull() .MaximumLength(50).WithMessage("{PropertyName} must no exceeed 50 characters"); RuleFor(x => x.Date) .NotEmpty().WithMessage("{PropertyName} is required") .NotNull() .GreaterThan(DateTime.Now); RuleFor(x => x) .MustAsync(EventNameAndDateUnique) .WithMessage("An event with the same name and date alread exists"); RuleFor(x => x.Price) .NotEmpty().WithMessage("{PropertyName} is required") .GreaterThan(0); }
public GetEventDetailQueryHandler(IMapper mapper, CleanCodeContext cleanCodeContext) { _mapper = mapper; _cleanCodeContext = cleanCodeContext; }
public CreateEventCommandHandler(IMapper mapper, CleanCodeContext cleanCodeContext) { _mapper = mapper; _cleanCodeContext = cleanCodeContext; }
public GetCategoriesListQueryHandler(IMapper mapper, CleanCodeContext dbContext) { _mapper = mapper; _dbContext = dbContext; }