コード例 #1
0
        public ActionResult Enable(ProductTypeModel[] model)
        {
            foreach (var item in model)
            {
                var type = _productTypeService.Find(item.Id);
                _productTypeService.Enable(type);
            }

            return AjaxForm().ReloadPage();
        }
コード例 #2
0
        public ActionResult Save(ProductTypeModel model, string @return)
        {
            ProductType productType = null;

            if (model.Id == 0)
            {
                productType = _productTypeService.Create(new CreateProductTypeRequest
                {
                    Name = model.Name,
                    SkuAlias = model.SkuAlias,
                    CustomFields = model.CustomFieldDefinitions,
                    VariantFields = model.VariantFieldDefinitions
                });
            }
            else
            {
                productType = _productTypeService.Update(new UpdateProductTypeRequest(model.Id)
                {
                    Name = model.Name,
                    SkuAlias = model.SkuAlias,
                    CustomFields = model.CustomFieldDefinitions,
                    VariantFields = model.VariantFieldDefinitions
                });
            }

            if (model.IsEnabled)
            {
                _productTypeService.Enable(productType);
            }
            else
            {
                _productTypeService.Disable(productType);
            }

            return AjaxForm().RedirectTo(@return);
        }