private void addNewBtn_Click(object sender, EventArgs e) { var item = _recordRepo.GetForAdd(); var dialog = new RecordDialog(item, false); if (dialog.ShowDialog() == DialogResult.OK) { _recordRepo.Add(dialog.Item); reloadAll(); } }
private void editBtn_Click(object sender, EventArgs e) { var selected = cyclingDiaryLv.SelectedIndices; if (selected.Count == 1) { var selectedIndex = selected[0]; var item = _recordRepo.GetForEdit(_recordIds[selectedIndex]); if (item == null) { return; } var dialog = new RecordDialog(item, true); var result = dialog.ShowDialog(); if (result == DialogResult.OK) { _recordRepo.Edit(dialog.Item); reloadAll(); } } }