public ActionResult Enable(ProductTypeModel[] model) { foreach (var item in model) { var type = _productTypeService.Find(item.Id); _productTypeService.Enable(type); } return AjaxForm().ReloadPage(); }
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); }