public IActionResult UpdateNote(long id, [FromBody] NoteModel note) { try { if (note == null) { return(BadRequest("Note is null.")); } Note userToUpdate = _notesBL.Get(id); if (userToUpdate == null) { return(NotFound("The User record couldn't be found.")); } bool result = _notesBL.Update(userToUpdate, note); if (result == true) { return(this.Ok(new { success = true, message = "Successfully edited" })); } else { return(this.BadRequest(new { success = false, message = "Editing Failed" })); } } catch (Exception ex) { return(this.Ok(new { success = false, message = ex.Message })); } }
public IActionResult Get(long noteid) { try { Note note = _notesBL.Get(noteid); if (note == null) { return(NotFound("The Employee record couldn't be found.")); } return(Ok(note)); } catch (Exception ex) { return(this.BadRequest(new { success = false, message = ex.Message })); } }