public async Task <IActionResult> PutNote([FromRoute] int id, [FromBody] Note note) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != note.ID) { return(BadRequest()); } try { await _notesService.EditNote(note); } catch (DbUpdateConcurrencyException) { if (!_notesService.NoteExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult <int> EditNote([FromBody] Notes note) { int result = _notesService.EditNote(note); if (result == 0) { return(BadRequest()); } return(Ok(result)); }
public ActionResult UpdateNote(int id, [FromBody] NoteWithCategories note) { try { _service.EditNote(id, note); _service.DeleteDanglingCategories(); } catch { return(BadRequest()); } return(Ok()); }
public async Task <IActionResult> PutNote([FromRoute] int id, [FromBody] Note note) { await _notesService.EditNote(id, note); return(NoContent()); }