public HttpResponseMessage Delete(HttpRequestMessage request, int id) { return(CreateHttpResponse(request, () => { HttpResponseMessage response = null; if (!ModelState.IsValid) { response = request.CreateResponse(HttpStatusCode.BadRequest, ModelState); } else { var ProductCategoryService = new ProductCategoryService(); ProductCategoryService.Deleteone(id); response = request.CreateResponse(HttpStatusCode.OK); } return response; })); }