public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
        {
            List <ValidationResult> errors = new List <ValidationResult>();
            ProductStatusRepository db     = new ProductStatusRepository();

            if (db.GetAll().Where(x => x.Status == Status).FirstOrDefault() != null)
            {
                errors.Add(new ValidationResult($"{nameof(Status)} exists already.", new List <string> {
                    nameof(Status)
                }));
            }



            return(errors);
        }
Esempio n. 2
0
        public string GetFilters()
        {
            var _colorRep    = new ProductColorRepository(_context);
            var _metalRep    = new ProductMetalRepository(_context);
            var _typeRep     = new ProductTypeRepository(_context);
            var _statusRep   = new ProductStatusRepository(_context);
            var _statusAvRep = new ProductAvStatusRepository(_context);
            var _genderRep   = new GenderRepository(_context);


            var filters = new ProductsFilters()
            {
                ColorList    = _colorRep.GetAllAvailable().Select(_mapper.Map <ProductColorView>),
                MetalList    = _metalRep.GetAllAvailable(),
                GenderList   = _genderRep.GetAllAvailable(),
                TypeList     = _typeRep.GetAllAvailable(),
                StatusList   = _statusRep.GetAllAvailable(),
                StatusAvList = _statusAvRep.GetAllAvailable()
            };

            ViewBag.Data = JsonConvert.SerializeObject(filters);
            return(ViewBag.Data);
        }
Esempio n. 3
0
        public UOW(DataContext DataContext, ICurrentContext CurrentContext)
        {
            this.DataContext    = DataContext;
            AuditLogRepository  = new AuditLogRepository(CurrentContext);
            SystemLogRepository = new SystemLogRepository(CurrentContext);

            AdministratorRepository = new AdministratorRepository(DataContext, CurrentContext);

            BrandRepository = new BrandRepository(DataContext, CurrentContext);

            CategoryRepository = new CategoryRepository(DataContext, CurrentContext);

            CustomerRepository = new CustomerRepository(DataContext, CurrentContext);

            CustomerGroupingRepository = new CustomerGroupingRepository(DataContext, CurrentContext);

            Customer_CustomerGroupingRepository = new Customer_CustomerGroupingRepository(DataContext, CurrentContext);

            DiscountContentRepository = new DiscountContentRepository(DataContext, CurrentContext);

            DiscountRepository = new DiscountRepository(DataContext, CurrentContext);

            Discount_CustomerGroupingRepository = new Discount_CustomerGroupingRepository(DataContext, CurrentContext);

            DistrictRepository = new DistrictRepository(DataContext, CurrentContext);

            EVoucherContentRepository = new EVoucherContentRepository(DataContext, CurrentContext);

            EVoucherRepository = new EVoucherRepository(DataContext, CurrentContext);

            ImageFileRepository = new ImageFileRepository(DataContext, CurrentContext);

            ItemRepository = new ItemRepository(DataContext, CurrentContext);

            MerchantAddressRepository = new MerchantAddressRepository(DataContext, CurrentContext);

            MerchantRepository = new MerchantRepository(DataContext, CurrentContext);

            OrderContentRepository = new OrderContentRepository(DataContext, CurrentContext);

            OrderRepository = new OrderRepository(DataContext, CurrentContext);

            OrderStatusRepository = new OrderStatusRepository(DataContext, CurrentContext);

            PaymentMethodRepository = new PaymentMethodRepository(DataContext, CurrentContext);

            ProductRepository = new ProductRepository(DataContext, CurrentContext);

            ProductStatusRepository = new ProductStatusRepository(DataContext, CurrentContext);

            ProductTypeRepository = new ProductTypeRepository(DataContext, CurrentContext);

            Product_MerchantAddressRepository = new Product_MerchantAddressRepository(DataContext, CurrentContext);

            Product_PaymentMethodRepository = new Product_PaymentMethodRepository(DataContext, CurrentContext);

            ProvinceRepository = new ProvinceRepository(DataContext, CurrentContext);

            ShippingAddressRepository = new ShippingAddressRepository(DataContext, CurrentContext);

            StockRepository = new StockRepository(DataContext, CurrentContext);

            VariationRepository = new VariationRepository(DataContext, CurrentContext);

            VariationGroupingRepository = new VariationGroupingRepository(DataContext, CurrentContext);

            WardRepository = new WardRepository(DataContext, CurrentContext);

            WarehouseRepository = new WarehouseRepository(DataContext, CurrentContext);
        }