Exemple #1
0
 public HttpResponseMessage DeleteByDelete(HttpRequestMessage request, int id)
 {
     return(CreateHttpResponse(request, () =>
     {
         HttpResponseMessage response = null;
         if (!ModelState.IsValid)
         {
             var Error = "Vui lòng nhập đủ dữ liệu để xóa";
             var Res = new Res
             {
                 Status = false,
                 Message = Error
             };
             response = request.CreateResponse(HttpStatusCode.BadRequest, Res);
         }
         else
         {
             var productCategoryVm = new ProductCategoryViewModel();
             var IdDele = _productCategoryService.GetById(productCategoryVm.ID);
             // IdDele.UpdateProductCategory(productCategoryVm);
             _productCategoryService.DeleteByDelete(id);
             _productCategoryService.Save();
             var responseData = Mapper.Map <ProductCategory, ProductCategoryViewModel>(IdDele);
             var Res = new Res
             {
                 Status = true,
                 Message = "Xóa thành công !!!",
                 Data = responseData
             };
             response = request.CreateResponse(HttpStatusCode.Created, Res);
         }
         return response;
     }));
 }