public ActionResult Create(CustomerTagModel model, bool continueEditing) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageCustomers)) return AccessDeniedView(); if (ModelState.IsValid) { var customertag = model.ToEntity(); _customerTagService.InsertCustomerTag(customertag); //activity log _customerActivityService.InsertActivity("AddNewCustomerTag", customertag.Id, _localizationService.GetResource("ActivityLog.AddNewCustomerTag"), customertag.Name); SuccessNotification(_localizationService.GetResource("Admin.Customers.CustomerTags.Added")); return continueEditing ? RedirectToAction("Edit", new { id = customertag.Id }) : RedirectToAction("List"); } //If we got this far, something failed, redisplay form return View(model); }
public ActionResult Edit(CustomerTagModel model, bool continueEditing) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageCustomers)) return AccessDeniedView(); var customertag = _customerTagService.GetCustomerTagById(model.Id); if (customertag == null) //No customer role found with the specified id return RedirectToAction("List"); try { if (ModelState.IsValid) { customertag = model.ToEntity(customertag); _customerTagService.UpdateCustomerTag(customertag); //activity log _customerActivityService.InsertActivity("EditCustomerTage", customertag.Id, _localizationService.GetResource("ActivityLog.EditCustomerTag"), customertag.Name); SuccessNotification(_localizationService.GetResource("Admin.Customers.CustomerTags.Updated")); return continueEditing ? RedirectToAction("Edit", new { id = customertag.Id}) : RedirectToAction("List"); } //If we got this far, something failed, redisplay form return View(model); } catch (Exception exc) { ErrorNotification(exc); return RedirectToAction("Edit", new { id = customertag.Id }); } }