public ActionResult Save(EditBrandCategoryViewModel model, string command) { if (command.ToLower() == "save") { string selectedIds = ""; try { selectedIds = Request.Form["SelectedIds"]; } catch { } var modelError = ProductService.InsertOrUpdateBrandCategory(model.BrandCategory, selectedIds.ToIntList(), CurrentUser, model.LGS); if (modelError.IsError) { prepareEditModel(model); model.SetErrorOnField(ErrorIcon.Error, modelError.Message, "BrandCategory_" + modelError.FieldName); return(View("Edit", model)); } else { return(RedirectToAction("BrandCategories")); } } else { return(RedirectToAction("BrandCategories")); } }
public ActionResult Edit(int id) { var model = new EditBrandCategoryViewModel(); prepareEditModel(model); model.BrandCategory = ProductService.FindBrandCategoryModel(id, CurrentCompany); model.BrandLists.SetAvailableItems(ProductService.FindBrandListItemModel()); model.BrandLists.SetSelectedItems(ProductService.FindBrandBrandCategoriesListItemModel(model.BrandCategory)); model.LGS = ProductService.LockBrandCategory(model.BrandCategory); return(View(model)); }
void prepareEditModel(EditBrandCategoryViewModel model) { PrepareViewModel(model, EvolutionResources.bnrAddEditBrandCategory, 0, MenuOptionFlag.RequiresNoProduct); }