Пример #1
0
 public IHttpActionResult Get(int id)
 {
     try
     {
         return(Ok(context.Get(id)));
     }
     catch (Exception ex)
     {
         return(Content(HttpStatusCode.NotAcceptable, ex.Message));
     }
 }
 public async Task <IActionResult> Get(int id)
 {
     try
     {
         return(Ok(await context.Get(id)));
     }
     catch (Exception ex)
     {
         return(BadRequest(new ErrorMessage(ex.Message)));
     }
 }