public async Task <ActionResult> Put(int id, [FromBody] Role model) { if (id != model.IdRole) { return(BadRequest()); } try { await _role.Edit(model); } catch (Exception ex) { if (!Exists(id)) { return(BadRequest()); } throw ex; } return(Ok(model)); }