public SaucerService(ISaucerQuery saucerQuery, ISaucerRepository saucerRepository, ISaucerValidator saucerValidator, INutritionInformationFactory nutritionInformationFactory)
 {
     _saucerQuery                 = saucerQuery;
     _saucerRepository            = saucerRepository;
     _saucerValidator             = saucerValidator;
     _nutritionInformationFactory = nutritionInformationFactory;
 }
예제 #2
0
        public ReservationValidator(IWorkerRepository workerRepository, ISaucerRepository saucerRepository, IDealerRepository dealerRepository, IReservationRepository reservationRepository)
        {
            _workerRepository      = workerRepository;
            _saucerRepository      = saucerRepository;
            _dealerRepository      = dealerRepository;
            _reservationRepository = reservationRepository;

            RuleSet("Base", () =>
            {
                RuleFor(reservation => reservation.Date).NotNull().NotEmpty();
                RuleFor(reservation => reservation.WorkerId).Must(workerId => workerId.IsNotZero()).WithMessage("Tienes que elegir un trabajador");
                RuleFor(reservation => reservation.SaucerId).Must(saucerId => saucerId.IsNotZero()).WithMessage("Tienes que elegir un platillo");
                RuleFor(reservation => reservation.DealerId).Must(dealerId => dealerId.IsNotZero()).WithMessage("Tienes que elegir un distribuidor");
                RuleFor(reservation => reservation.Portion).Must(portion => portion.IsNotZero()).WithMessage("Tienes que elegir una porcion");
                RuleFor(reservation => reservation.MealType).NotNull().NotEmpty();
                Custom(ReferencesValidate);
                Custom(DateValidate);
            });

            RuleSet("Create", () =>
            {
                Custom(CreateReservationValidate);
            });

            RuleSet("Update", () =>
            {
                Custom(UpdateReservationValidate);
            });
        }
        public MenuValidator(IDealerRepository dealerRepository, ISaucerRepository saucerRepository, IMenuRepository menuRepository)
        {
            _dealerRepository = dealerRepository;
            _saucerRepository = saucerRepository;
            _menuRepository   = menuRepository;

            RuleSet("Base", () =>
            {
                RuleFor(menu => menu.MealType).NotNull().NotEmpty();
                RuleFor(menu => menu.StartDate).NotNull().NotEmpty();
                RuleFor(menu => menu.EndDate).NotNull().NotEmpty();
                RuleFor(menu => menu.MaxAmount).NotNull().NotEmpty();
                RuleFor(menu => menu.DealerId).Must(dealerId => dealerId.IsNotZero()).WithMessage("Tienes que elegir un distribuidor");
                RuleFor(menu => menu.SaucerId).Must(saucerId => saucerId.IsNotZero()).WithMessage("Tienes que elegir un platillo");
                Custom(ReferencesValidate);
                Custom(DatesValidate);
                Custom(MaxAmountValidate);
            });

            RuleSet("Create", () =>
            {
                Custom(TodayValidate);
            });

            RuleSet("Update", () =>
            {
                Custom(EditStartDateValidate);
            });
        }
        public SaucerMultimediaValidator(ISaucerRepository saucerRepository)
        {
            _saucerRepository = saucerRepository;

            RuleSet("Base", () =>
            {
                RuleFor(saucerMultimedia => saucerMultimedia.SaucerId).Must(saucerId => saucerId.IsNotZero()).WithMessage("Tienes que elegir un platillo");
                Custom(ReferencesValidate);
            });
        }
예제 #5
0
        public DealerSaucerValidator(IDealerRepository dealerRepository, ISaucerRepository saucerRepository, IDealerSaucerRepository dealerSaucerRepository)
        {
            _dealerRepository       = dealerRepository;
            _saucerRepository       = saucerRepository;
            _dealerSaucerRepository = dealerSaucerRepository;

            RuleSet("Base", () =>
            {
                RuleFor(dealerSaucer => dealerSaucer.DealerId).Must(dealerId => dealerId.IsNotZero()).WithMessage("Tienes que elegir un distribuidor");
                RuleFor(dealerSaucer => dealerSaucer.SaucerId).Must(saucerId => saucerId.IsNotZero()).WithMessage("Tienes que elegir un platillo");
                Custom(ReferencesValidate);
            });
        }
예제 #6
0
        public SaucerConfigurationValidator(ISaucerRepository saucerRepository, IIngredientRepository ingredientRepository, ISaucerConfigurationRepository saucerConfigurationRepository)
        {
            _saucerRepository              = saucerRepository;
            _ingredientRepository          = ingredientRepository;
            _saucerConfigurationRepository = saucerConfigurationRepository;

            RuleSet("Base", () =>
            {
                RuleFor(saucerConfiguration => saucerConfiguration.SaucerId).Must(saucerId => saucerId.IsNotZero()).WithMessage("Tienes que elegir un platillo");
                RuleFor(saucerConfiguration => saucerConfiguration.IngredientId).Must(ingredientId => ingredientId.IsNotZero()).WithMessage("Tienes que elegir un ingrediente");
                RuleFor(saucerConfiguration => saucerConfiguration.Portion).Must(portion => portion.IsNotZero()).WithMessage("Tienes que elegir una porcion");
                Custom(ReferencesValidate);
            });

            RuleSet("Create", () =>
            {
                Custom(CreateConfigurationValidate);
            });

            RuleSet("Update", () =>
            {
                Custom(UpdateConfigurationValidate);
            });
        }
예제 #7
0
 public MenuFactory(IDealerRepository dealerRepository, ISaucerRepository saucerRepository)
 {
     _dealerRepository = dealerRepository;
     _saucerRepository = saucerRepository;
 }
 public SaucerConfigurationFactory(ISaucerRepository saucerRepository, IIngredientRepository ingredientRepository)
 {
     _saucerRepository     = saucerRepository;
     _ingredientRepository = ingredientRepository;
 }
 public ReservationFactory(IWorkerRepository workerRepository, ISaucerRepository saucerRepository, IDealerRepository dealerRepository)
 {
     _workerRepository = workerRepository;
     _saucerRepository = saucerRepository;
     _dealerRepository = dealerRepository;
 }