Exemple #1
0
        public JsonResult Delete(int id)
        {
            if (_service.CheckDelete(id) == 1)
            {
                return(Json(new { result = Constants.UnDelete }));
            }

            var f*g = _service.Delete(id);

            return(Json(f*g == 0 ? new { result = true } : new { result = false }));
        }
Exemple #2
0
 public HttpResponseMessage Delete(HttpRequestMessage request, int id)
 {
     return(CreateHttpResponse(request, () =>
     {
         HttpResponseMessage response = null;
         if (!ModelState.IsValid)
         {
             response = request.CreateResponse(HttpStatusCode.BadRequest, ModelState);
         }
         else
         {
             var oldPO = _poService.Delete(id);
             _poService.Save();
             var responseData = Mapper.Map <PO, POViewModel>(oldPO);
             response = request.CreateResponse(HttpStatusCode.Created, responseData);
         }
         return response;
     }));
 }