예제 #1
0
 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();
         }
     }
 }
예제 #2
0
        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();
                }
            }
        }