private void createNoteBtn_Click(object sender, EventArgs e) { var dialog = new NoteDialog(new Note(), false); var result = dialog.ShowDialog(); if (result == DialogResult.OK) { _noteRepo.Add(dialog.Item); reloadNotes(); } }
private void editNoteBtn_Click(object sender, EventArgs e) { var selected = notesLv.SelectedIndices; if (selected.Count == 1) { var selectedIndex = selected[0]; var note = _notes[selectedIndex]; var dialog = new NoteDialog(note, true); var result = dialog.ShowDialog(); if (result == DialogResult.OK) { _noteRepo.Edit(dialog.Item); reloadNotes(); } } }