public AccountingBookCreateValidator(IAccountingBookRepository accountingBookRepository) { this.accountingBookRepository = accountingBookRepository; RuleFor(a => a.BookId) .GreaterThan(0).WithMessage("{PropertyName} must be grater than 0.") .NotNull(); RuleFor(a => a.BookOrderNumberId) .GreaterThan(0).WithMessage("{PropertyName} must be grater than 0.") .NotNull(); RuleFor(a => a) .MustAsync(IdUnique).WithMessage("Combination of book id and order number must be unique."); RuleFor(a => a.Name) .NotEmpty().WithMessage("{PropertyName} is required.") .NotNull(); RuleFor(a => a.RelatedGroupId) .NotEmpty().WithMessage("{PropertyName} is required."); }
public AccountingBookService(IAccountingBookRepository accountingBookRepository, IMapper mapper, IValidator <AccountingBookDTO> updateValidator, IValidator <AccountingBookCreateDTO> createValidator) : base(accountingBookRepository, mapper, updateValidator, createValidator) { }