public Note CreateNew() { if (string.IsNullOrWhiteSpace(NewNoteText)) { return(null); } _changedNote = Note.Create(NewNoteText); NoteStorage.SaveOrUpdate(_changedNote); NewNoteText = string.Empty; return(_changedNote); }
public void Update() { var newText = NoteText?.Trim(); Check.DoCheckOperationValid(!string.IsNullOrEmpty(newText), () => "Note text must not be empty."); if (Note == null) { Note = ReadFromStorage(); } if (Note.Text != newText) { Note.Text = newText; Note.LastUpdateTime = DateTime.Now; NoteStorage.SaveOrUpdate(Note); } }