private void BtnAddBook_Click(object sender, EventArgs e) { using (var form = new AddEditBookForm(null, booksRepository)) { if (form.ShowDialog() == DialogResult.OK) { bookBindingSource.DataSource = booksRepository.GetAll().ToList(); } } }
private void BtnEditBook_Click(object sender, EventArgs e) { if (bookBindingSource.Current == null) { return; } using (var form = new AddEditBookForm((Book)bookBindingSource.Current, booksRepository)) { if (form.ShowDialog() == DialogResult.OK) { bookBindingSource.ResetCurrentItem(); } } }