public async Task <Note> GetNoteByIdAsync(int noteId) { try { Casenotes dbNote = await _context.Casenotes.FirstOrDefaultAsync(n => n.Noteid == noteId); if (dbNote == null) { return(null); } return(CaseNoteMapper.Map(dbNote)); } catch (Exception e) { return(null); } }
public async Task <bool> UpdateNoteAsync(Note note, bool save = true) { try { Casenotes dbNote = await _context.Casenotes.FirstOrDefaultAsync(n => n.Noteid == note.Id); dbNote.Content = note.Content; _context.Casenotes.Update(dbNote); if (save) { await _context.SaveChangesAsync(); } return(true); } catch (Exception e) { return(false); } }