Beispiel #1
0
        public WorkOrderCreateCommandValidator(IGenericReadRepository readRepository, IUserFiltersProvider userFiltersProvider,
                                               IValidator <WorkOrderClientCreateCommand> clientValidator, IWorkFiltersProvider workFiltersProvider) : base(readRepository)
        {
            _userFiltersProvider = userFiltersProvider;
            _workFiltersProvider = workFiltersProvider;

            RuleFor(x => x.WorkerId)
            .NotEmptyWithMessage()
            .MustAsync(WorkerIsValid)
            .WithMessage($"The {{PropertyName}} is invalid. User should be Active and has ServiceMan role.");

            RuleFor(x => x.Client)
            .SetValidator(clientValidator);

            RuleFor(x => x.WorksIds)
            .NotEmptyWithMessage();

            RuleForEach(x => x.WorksIds)
            .NotEmptyWithMessage()
            .MustExistsWithMessageAsync(WorkExists);
        }
Beispiel #2
0
 public WorkOrderCommandFunctionality(IUnitOfWork unitOfWork, IMapperFactory mapperFactory, IGenericWriteRepository writeRepository, IValidatorFactory validatorFactory, IGenericReadRepository readRepository, IWorkOrderFiltersProvider orderFiltersProvider, IWorkFiltersProvider workFiltersProvider) : base(unitOfWork, mapperFactory, writeRepository, validatorFactory)
 {
     _readRepository       = readRepository;
     _orderFiltersProvider = orderFiltersProvider;
     _workFiltersProvider  = workFiltersProvider;
 }
 public WorkQueryFunctionality(IUnitOfWork unitOfWork, IMapperFactory mapperFactory, IGenericReadRepository readRepository, IWorkFiltersProvider filtersProvider) : base(unitOfWork, mapperFactory, readRepository, filtersProvider)
 {
 }