Пример #1
0
 public IHttpActionResult Select([FromUri] string expand = null)
 {
     try
     {
         var values = service.Select(expand ?? defaultExpand)
                      .ToList();
         return(Ok(values));
     }
     catch (UnauthorizedAccessException)
     {
         return(StatusCode(HttpStatusCode.Forbidden));
     }
     catch (Exception e)
     {
         return(InternalServerError(e));
     }
 }
Пример #2
0
 public ActionResult List([FromQuery] string expand = defaultExpand)
 {
     try
     {
         var values = service.Select(expand).ToList();
         return(Ok(values));
     }
     catch (UnauthorizedAccessException)
     {
         return(Forbid());
     }
     catch (Exception e)
     {
         //return StatusCode(StatusCodes.Status500InternalServerError, e);
         //return new StatusCodeResult(StatusCodes.Status500InternalServerError);
         //throw e;
         return(this.InternalServerError(e));
     }
 }