public virtual CustomerTag UpdateCustomerTagModel(CustomerTag customerTag, CustomerTagModel model) { customerTag = model.ToEntity(customerTag); customerTag.Name = customerTag.Name.ToLower(); _customerTagService.UpdateCustomerTag(customerTag); //activity log _customerActivityService.InsertActivity("EditCustomerTage", customerTag.Id, _localizationService.GetResource("ActivityLog.EditCustomerTag"), customerTag.Name); return(customerTag); }
public virtual async Task <CustomerTag> UpdateCustomerTagModel(CustomerTag customerTag, CustomerTagModel model) { customerTag = model.ToEntity(customerTag); customerTag.Name = customerTag.Name.ToLower(); await _customerTagService.UpdateCustomerTag(customerTag); //activity log await _customerActivityService.InsertActivity("EditCustomerTage", customerTag.Id, _translationService.GetResource("ActivityLog.EditCustomerTag"), customerTag.Name); return(customerTag); }
public IActionResult 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); customertag.Name = customertag.Name.ToLower(); _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 })); } }