Пример #1
0
 public bool SaveNote(Note note)
 {
     try
     {
         _db.Note.Add(note);
         _db.SaveChanges();
         return true;
     }
     catch (Exception)
     {
         return false;
     }
 }
Пример #2
0
 private void SaveNote_Click(object sender, EventArgs e)
 {
     var recipientId = _userService.GetUserIdByEmail(NameBox.Text.Trim());
     var newNote = new Note
     {
         Body = NoteText.Text,
         From = "testSave",
         To = recipientId
     };
     if (_noteService.SaveNote(newNote))
     {
         NoteText.Text = "";
     }
 }