예제 #1
0
 public IHttpActionResult Get(int Id)
 {
     try
     {
         return(Ok(context.GetById(Id)));
     }
     catch (Exception ex)
     {
         return(Content(HttpStatusCode.NotFound, ex.Message));
     }
 }
예제 #2
0
 public IActionResult Get(int Id)
 {
     try
     {
         return(Ok(context.GetById(Id)));
     }
     catch (Exception ex)
     {
         return(BadRequest(new ErrorMessage(ex.Message)));
     }
 }