Exemplo n.º 1
0
 public IHttpActionResult AddRole(int id, int link)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     try
     {
         service.AddPrincipal(id, link);
         return(StatusCode(HttpStatusCode.NoContent));
     }
     catch (NotSupportedException)
     {
         return(BadRequest());
     }
     catch (UnauthorizedAccessException)
     {
         return(StatusCode(HttpStatusCode.Forbidden));
     }
     catch (KeyNotFoundException)
     {
         return(NotFound());
     }
 }