예제 #1
0
        private void BtAdd_Click(object sender, RoutedEventArgs e)
        {
            AddEditBook addWindow = new AddEditBook();

            addWindow.ShowDialog();

            if (addWindow.DialogResult == true)
            {
                if (bookModel.AddBook(addWindow.GetSelectedBook()))
                {
                    MessageBox.Show("Book was added successfuly", "Success", MessageBoxButton.OK, MessageBoxImage.Information);
                    refreshBooks();
                }
            }
        }
예제 #2
0
        private void BtEdit_Click(object sender, RoutedEventArgs e)
        {
            if (dgvBooks.SelectedItem == null)
            {
                MessageBox.Show("Select a book to modify", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            AddEditBook editWindow = new AddEditBook((Book)dgvBooks.SelectedItem);

            editWindow.ShowDialog();

            if (editWindow.DialogResult == true)
            {
                if (bookModel.EditBook(editWindow.GetSelectedBook()))
                {
                    MessageBox.Show("Book was modified successfuly", "Success", MessageBoxButton.OK, MessageBoxImage.Information);
                    refreshBooks();
                }
            }
        }