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)); } }
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)); } }