示例#1
0
 public HttpResponseMessage Get(int id)
 {
     try
     {
         var res = CommitRepository.Read(id);
         return(Request.CreateResponse(HttpStatusCode.OK, res));
     }
     catch (ElementNotFoundException e)
     {
         return(Request.CreateResponse(HttpStatusCode.BadRequest, e.Message));
     }
     catch (Exception)
     {
         return(Request.CreateResponse(HttpStatusCode.BadRequest, "Generic error happened."));
     }
 }