private void btnAdd_Click(object sender, EventArgs e) { Person director = new Person(); using (EditDirectorDialog dlg = new EditDirectorDialog(director)) { dlg.StartPosition = FormStartPosition.CenterParent; if (dlg.ShowDialog() != DialogResult.OK) return; _movieRepository.Add(director); lstDirectors.SelectedItem = director; UpdateButtons(); } }
private void btnEdit_Click(object sender, EventArgs e) { if (CurrentDirector == null) return; Person directorCopy = new Person(CurrentDirector); using (EditDirectorDialog dlg = new EditDirectorDialog(directorCopy)) { dlg.StartPosition = FormStartPosition.CenterParent; if (dlg.ShowDialog() != DialogResult.OK) return; CurrentDirector.Update(directorCopy); } }