예제 #1
0
        public Note CreateNew()
        {
            if (string.IsNullOrWhiteSpace(NewNoteText))
            {
                return(null);
            }

            _changedNote = Note.Create(NewNoteText);

            NoteStorage.SaveOrUpdate(_changedNote);
            NewNoteText = string.Empty;

            return(_changedNote);
        }
예제 #2
0
        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);
            }
        }