示例#1
0
 public HttpResponseMessage Save(CultureModel aCultureModel)
 {
     try
     {
         if (this.ModelState.IsValid)
         {
             var culList = service.SaveCulture(aCultureModel);
             if (culList != null)
             {
                 return(Request.CreateResponse(HttpStatusCode.OK, culList));
             }
             else
             {
                 string message = "Error Saving Data";
                 return(Request.CreateErrorResponse(HttpStatusCode.Forbidden, message));
             }
         }
         else
         {
             return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
         }
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.InnerException.Message));
     }
 }