public IHttpActionResult Update(int id, [FromBody] Principal value) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { service.Update(id, value); return(StatusCode(HttpStatusCode.NoContent)); } catch (NotSupportedException) { return(BadRequest()); } catch (UnauthorizedAccessException) { return(StatusCode(HttpStatusCode.Forbidden)); } catch (KeyNotFoundException) { return(NotFound()); } catch (Exception e) { return(InternalServerError(e)); } }
public ActionResult Update(int id, Principal value) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { service.Update(id, value); return(NoContent()); } catch (NotSupportedException) { return(BadRequest()); } catch (UnauthorizedAccessException) { return(Forbid()); } catch (KeyNotFoundException) { return(NotFound()); } catch (Exception e) { return(StatusCode(StatusCodes.Status500InternalServerError, e)); } }