コード例 #1
0
 public HttpResponseMessage Delete(string id)
 {
     try
     {
         preg_country country = dao.GetItemByID(Convert.ToInt32(id)).FirstOrDefault();
         if (country == null)
         {
             return(Request.CreateErrorResponse(HttpStatusCode.NotFound, SysConst.DATA_NOT_FOUND));
         }
         dao.DeleteData(country);
         return(Request.CreateResponse(HttpStatusCode.Accepted, SysConst.DATA_DELETE_SUCCESS));
     }
     catch (Exception ex)
     {
         HttpError err = new HttpError(ex.Message);
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, err));
     }
 }