public HttpResponseMessage UpdateRol([FromUri] int id, [FromBody] ActualizarRolRequest request) { var rol = RolesRepository.ConsultarRolByID(id); if (rol == null) { return(Request.CreateResponse(HttpStatusCode.NotFound)); } rol.NameRol = request.NameRol; RolesRepository.ActualizarRol(id, request.NameRol); return(Request.CreateResponse(HttpStatusCode.OK)); }
public HttpResponseMessage GetRoleByID(int id) { try { var rol = RolesRepository.ConsultarRolByID(id); if (rol == null) { return(Request.CreateResponse(HttpStatusCode.NotFound)); } return(Request.CreateResponse(HttpStatusCode.OK, rol)); } catch (Exception e) { Console.WriteLine($"An Exception has been caught: {e.Message}"); return(Request.CreateResponse(HttpStatusCode.InternalServerError)); } }