コード例 #1
0
        private void createButton_Click(object sender, EventArgs e)
        {
            var books  = _context.booksProvider.GetAll();
            var editor = new BookFormEditor(books);
            var res    = editor.ShowDialog();

            if (res != DialogResult.OK)
            {
                return;
            }

            _context.booksProvider.Insert(editor.Book);

            RefreshData();
        }
コード例 #2
0
        private void editButton_Click(object sender, EventArgs e)
        {
            if (bookGridView.SelectedRows == null)
            {
                return;
            }
            var selectedBook = bookGridView.SelectedRows[0].DataBoundItem as Book;
            var books        = _context.booksProvider.GetAll();
            var editor       = new BookFormEditor(books);
            var res          = editor.ShowDialog(selectedBook);

            if (res != DialogResult.OK)
            {
                return;
            }

            _context.booksProvider.Update(editor.Book);
            RefreshData();
        }