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 CustomerTag InsertCustomerTagModel(CustomerTagModel model) { var customertag = model.ToEntity(); customertag.Name = customertag.Name.ToLower(); _customerTagService.InsertCustomerTag(customertag); //activity log _customerActivityService.InsertActivity("AddNewCustomerTag", customertag.Id, _localizationService.GetResource("ActivityLog.AddNewCustomerTag"), 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 virtual async Task <CustomerTag> InsertCustomerTagModel(CustomerTagModel model) { var customertag = model.ToEntity(); customertag.Name = customertag.Name.ToLower(); await _customerTagService.InsertCustomerTag(customertag); //activity log await _customerActivityService.InsertActivity("AddNewCustomerTag", customertag.Id, _translationService.GetResource("ActivityLog.AddNewCustomerTag"), customertag.Name); return(customertag); }
public IActionResult Create(CustomerTagModel model, bool continueEditing) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageCustomers)) return AccessDeniedView(); if (ModelState.IsValid) { var customertag = model.ToEntity(); customertag.Name = customertag.Name.ToLower(); _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 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 })); } }