Exemplo n.º 1
0
 public IHttpActionResult Read(int id, [FromUri] string expand = null)
 {
     try
     {
         var value = service.Read(id, expand ?? defaultExpand);
         return(Ok(value));
     }
     catch (UnauthorizedAccessException)
     {
         return(StatusCode(HttpStatusCode.Forbidden));
     }
     catch (KeyNotFoundException)
     {
         return(NotFound());
     }
     catch (Exception e)
     {
         return(InternalServerError(e));
     }
 }
Exemplo n.º 2
0
 public ActionResult <Principal> Read(int id, [FromQuery] string expand = defaultExpand)
 {
     try
     {
         var value = service.Read(id, expand);
         return(Ok(value));
     }
     catch (UnauthorizedAccessException)
     {
         return(Forbid());
     }
     catch (KeyNotFoundException)
     {
         return(NotFound());
     }
     catch (Exception e)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, e));
     }
 }