Beispiel #1
0
        public GearboxCreateCommandValidator(IGenericReadRepository readRepository, IGearboxFiltersProvider filtersProvider) : base(readRepository)
        {
            _filtersProvider = filtersProvider;

            RuleFor(x => x.Name)
            .NotEmptyWithMessage()
            .MaxLengthWithMessage(GearboxConstraints.NameMaxLength)
            .MustNotExistWithMessageAsync(NameDoesNotExist);
        }
Beispiel #2
0
        public CarEngineGearboxAssignCommandValidator(IGenericReadRepository readRepository, ICarEngineFiltersProvider engineFiltersProvider,
                                                      IGearboxFiltersProvider gearboxFiltersProvider, ICarModelFiltersProvider modelFiltersProvider,
                                                      IEngineSupportsGearboxFiltersProvider engineSupportsGearboxFiltersProvider) : base(readRepository)
        {
            _engineFiltersProvider  = engineFiltersProvider;
            _gearboxFiltersProvider = gearboxFiltersProvider;
            _modelFiltersProvider   = modelFiltersProvider;
            _engineSupportsGearboxFiltersProvider = engineSupportsGearboxFiltersProvider;

            RuleFor(x => x.ModelId)
            .NotEmptyWithMessage()
            .MustExistsWithMessageAsync(ModelExists);

            RuleFor(x => x.EngineId)
            .NotEmptyWithMessage()
            .MustExistsWithMessageAsync(EngineExists);

            RuleFor(x => x.GearboxId)
            .NotEmptyWithMessage()
            .MustExistsWithMessageAsync(GearboxExists);

            RuleFor(x => x.Price)
            .IsPositiveOrZeroWithMessage();
        }
 public GearboxQueryFunctionality(IUnitOfWork unitOfWork, IMapperFactory mapperFactory,
                                  IGenericReadRepository readRepository, IGearboxFiltersProvider filtersProvider) : base(unitOfWork, mapperFactory, readRepository, filtersProvider)
 {
 }