public ActionResult Edit(int id, int customerId) { var model = new EditBrandCategorySalesPersonViewModel(); prepareEditModel(model, id, customerId); model.CustomerAccountManager = CustomerService.FindBrandCategorySalesPersonModel(id, model.CurrentCompany, customerId); model.LGS = CustomerService.LockBrandCategorySalesPerson(model.CustomerAccountManager); return(View(model)); }
void prepareEditModel(EditBrandCategorySalesPersonViewModel model, int id, int customerId) { var customer = CustomerService.FindCustomerModel(customerId, CurrentCompany); string title = EvolutionResources.bnrAddEditCustomerAccountManager + (customer == null ? "" : " - " + customer.Name); if (id <= 0) { title += " - " + EvolutionResources.lblNewAddress; } PrepareViewModel(model, title, customerId, MakeMenuOptionFlags(customerId, 0)); model.BrandCategoryList = ProductService.FindBrandCategoryListItemModel(model.CurrentCompany); model.SalesPersonList = MembershipManagementService.FindUserListItemModel(); model.SalesPersonTypeList = LookupService.FindLOVItemsListItemModel(null, LOVName.SalesPersonType); model.ParentId = customerId; }
public ActionResult Save(EditBrandCategorySalesPersonViewModel model, string command) { if (command.ToLower() == "save") { var modelError = CustomerService.InsertOrUpdateBrandCategorySalesPerson(model.CustomerAccountManager, CurrentUser, model.LGS); if (modelError.IsError) { prepareEditModel(model, model.CurrentCompany.Id, model.CustomerAccountManager.CustomerId); model.SetErrorOnField(ErrorIcon.Error, modelError.Message, "CustomerAccountManager_" + modelError.FieldName); return(View("Edit", model)); } else { return(RedirectToAction("CustomerAccountManagers", new { id = model.ParentId })); } } else { return(RedirectToAction("CustomerAccountManagers", new { id = model.ParentId })); } }