コード例 #1
0
        public IActionResult ProductUpdate(ManufacturerModel.ManufacturerProductModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageManufacturers))
            {
                return(AccessDeniedView());
            }
            var product = _productService.GetProductById(model.ProductId);

            if (product == null)
            {
                throw new ArgumentException("No product found with the specified id");
            }

            var productManufacturer = product.ProductManufacturers.Where(x => x.Id == model.Id).FirstOrDefault();

            if (productManufacturer == null)
            {
                throw new ArgumentException("No product manufacturer mapping found with the specified id");
            }

            productManufacturer.IsFeaturedProduct = model.IsFeaturedProduct;
            productManufacturer.DisplayOrder      = model.DisplayOrder;
            productManufacturer.ProductId         = model.ProductId;
            _manufacturerService.UpdateProductManufacturer(productManufacturer);

            return(new NullJsonResult());
        }
コード例 #2
0
 public IActionResult ProductUpdate(ManufacturerModel.ManufacturerProductModel model)
 {
     if (ModelState.IsValid)
     {
         _manufacturerViewModelService.ProductUpdate(model);
         return(new NullJsonResult());
     }
     return(ErrorForKendoGridJson(ModelState));
 }
コード例 #3
0
        public ActionResult ProductUpdate(GridCommand command, ManufacturerModel.ManufacturerProductModel model)
        {
            var productManufacturer = _manufacturerService.GetProductManufacturerById(model.Id);

            productManufacturer.IsFeaturedProduct = model.IsFeaturedProduct;
            productManufacturer.DisplayOrder      = model.DisplayOrder1;

            _manufacturerService.UpdateProductManufacturer(productManufacturer);

            return(ProductList(command, productManufacturer.ManufacturerId));
        }
コード例 #4
0
        public async Task <IActionResult> ProductDelete(ManufacturerModel.ManufacturerProductModel model)
        {
            if (ModelState.IsValid)
            {
                await _manufacturerViewModelService.ProductDelete(model.Id, model.ProductId);

                return(new NullJsonResult());
            }

            return(ErrorForKendoGridJson(ModelState));
        }
コード例 #5
0
        public ActionResult ProductUpdate(GridCommand command, ManufacturerModel.ManufacturerProductModel model)
        {
            var productManufacturer = _manufacturerService.GetProductManufacturerById(model.Id);

            if (_permissionService.Authorize(StandardPermissionProvider.ManageCatalog))
            {
                productManufacturer.IsFeaturedProduct = model.IsFeaturedProduct;
                productManufacturer.DisplayOrder      = model.DisplayOrder1;

                _manufacturerService.UpdateProductManufacturer(productManufacturer);
            }

            return(ProductList(command, productManufacturer.ManufacturerId));
        }
コード例 #6
0
        public ActionResult ProductUpdate(GridCommand command, ManufacturerModel.ManufacturerProductModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageCatalog))
            {
                return(AccessDeniedView());
            }

            var productManufacturer = _manufacturerService.GetProductManufacturerById(model.Id);

            if (productManufacturer == null)
            {
                throw new ArgumentException("No product manufacturer mapping found with the specified id");
            }

            productManufacturer.IsFeaturedProduct = model.IsFeaturedProduct;
            productManufacturer.DisplayOrder      = model.DisplayOrder1;
            _manufacturerService.UpdateProductManufacturer(productManufacturer);

            return(ProductList(command, productManufacturer.ManufacturerId));
        }
コード例 #7
0
        public virtual async Task ProductUpdate(ManufacturerModel.ManufacturerProductModel model)
        {
            var product = await _productService.GetProductById(model.ProductId);

            if (product == null)
            {
                throw new ArgumentException("No product found with the specified id");
            }

            var productManufacturer = product.ProductManufacturers.Where(x => x.Id == model.Id).FirstOrDefault();

            if (productManufacturer == null)
            {
                throw new ArgumentException("No product manufacturer mapping found with the specified id");
            }

            productManufacturer.IsFeaturedProduct = model.IsFeaturedProduct;
            productManufacturer.DisplayOrder      = model.DisplayOrder;
            productManufacturer.ProductId         = model.ProductId;
            await _manufacturerService.UpdateProductManufacturer(productManufacturer);
        }