public virtual void DeleteCustomerAttributeValue(CustomerAttributeValueModel model) { var av = _customerAttributeService.GetCustomerAttributeById(model.CustomerAttributeId); var cav = av.CustomerAttributeValues.FirstOrDefault(x => x.Id == model.Id); if (cav == null) { throw new ArgumentException("No customer attribute value found with the specified id"); } _customerAttributeService.DeleteCustomerAttributeValue(cav); }
public ActionResult ValueDelete(int id) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings)) { return(AccessDeniedView()); } var cav = _customerAttributeService.GetCustomerAttributeValueById(id); if (cav == null) { throw new ArgumentException("No customer attribute value found with the specified id"); } _customerAttributeService.DeleteCustomerAttributeValue(cav); return(new NullJsonResult()); }
public ActionResult ValueDelete(CustomerAttributeValueModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings)) { return(AccessDeniedView()); } var av = _customerAttributeService.GetCustomerAttributeById(model.CustomerAttributeId); var cav = av.CustomerAttributeValues.FirstOrDefault(x => x.Id == model.Id); if (cav == null) { throw new ArgumentException("No customer attribute value found with the specified id"); } _customerAttributeService.DeleteCustomerAttributeValue(cav); return(new NullJsonResult()); }
public virtual IActionResult ValueDelete(int id) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings)) { return(AccessDeniedView()); } //try to get a customer attribute value with the specified id var customerAttributeValue = _customerAttributeService.GetCustomerAttributeValueById(id) ?? throw new ArgumentException("No customer attribute value found with the specified id", nameof(id)); _customerAttributeService.DeleteCustomerAttributeValue(customerAttributeValue); //activity log _customerActivityService.InsertActivity("DeleteCustomerAttributeValue", string.Format(_localizationService.GetResource("ActivityLog.DeleteCustomerAttributeValue"), customerAttributeValue.Id), customerAttributeValue); return(new NullJsonResult()); }
public virtual ActionResult ValueDelete(int id) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings)) { return(AccessDeniedView()); } var cav = _customerAttributeService.GetCustomerAttributeValueById(id); if (cav == null) { throw new ArgumentException("No customer attribute value found with the specified id"); } _customerAttributeService.DeleteCustomerAttributeValue(cav); //activity log _customerActivityService.InsertActivity("DeleteCustomerAttributeValue", _localizationService.GetResource("ActivityLog.DeleteCustomerAttributeValue"), cav.Id); return(new NullJsonResult()); }
/// <summary> /// Deletes a customer attribute value /// </summary> /// <param name="customerAttributeValue">Customer attribute value</param> public void DeleteCustomerAttributeValue(CustomerAttributeValue customerAttributeValue) { _customerAttributeService.DeleteCustomerAttributeValue(customerAttributeValue); }