예제 #1
0
        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.");
        }
예제 #2
0
 public AccountingBookService(IAccountingBookRepository accountingBookRepository, IMapper mapper,
                              IValidator <AccountingBookDTO> updateValidator, IValidator <AccountingBookCreateDTO> createValidator)
     : base(accountingBookRepository, mapper, updateValidator, createValidator)
 {
 }