public virtual IActionResult PredefinedProductAttributeValueDelete(int id) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageAttributes)) { return(AccessDeniedView()); } //try to get a predefined product attribute value with the specified id var productAttributeValue = _productAttributeService.GetPredefinedProductAttributeValueById(id) ?? throw new ArgumentException("No predefined product attribute value found with the specified id", nameof(id)); _productAttributeService.DeletePredefinedProductAttributeValue(productAttributeValue); return(new NullJsonResult()); }
public ActionResult PredefinedProductAttributeValueDelete(int id) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageAttributes)) { return(AccessDeniedView()); } var ppav = _productAttributeService.GetPredefinedProductAttributeValueById(id); if (ppav == null) { throw new ArgumentException("No predefined product attribute value found with the specified id"); } _productAttributeService.DeletePredefinedProductAttributeValue(ppav); return(new NullJsonResult()); }
public virtual HttpResponseMessage PredefinedProductAttributeValueDelete(HttpRequestMessage request, int id) { return(CreateHttpResponse(request, () => { HttpResponseMessage response = request.CreateErrorResponse(HttpStatusCode.NotFound, "No product attribute value found with the specified id"); if (!ModelState.IsValid) { response = request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState); } else { var ppav = _productAttributeService.GetPredefinedProductAttributeValueById(id); if (ppav != null) { _productAttributeService.DeletePredefinedProductAttributeValue(ppav); _baseService.Commit(); response = request.CreateResponse <PredefinedProductAttributeValue>(HttpStatusCode.OK, ppav); } } return response; })); }