public IActionResult PutAgenda(int id, [FromBody] Agenda agenda) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != agenda.Id) { return(BadRequest()); } try { _agendaService.Update(id, agenda); } catch (DbUpdateConcurrencyException) { if (!_agendaService.AgendaExists(id)) { return(NotFound()); } else { throw new AppException("Update failed"); } } return(NoContent()); }