示例#1
0
        private void BtAdd_Click(object sender, RoutedEventArgs e)
        {
            AddEditAuthor addWindow = new AddEditAuthor();

            addWindow.ShowDialog();

            if (addWindow.DialogResult == true)
            {
                if (authorModel.AddAuthor(addWindow.GetSelectedAuthor()))
                {
                    MessageBox.Show("Author was added successfuly", "Success", MessageBoxButton.OK, MessageBoxImage.Information);
                    refreshAuthors();
                }
            }
        }
示例#2
0
        private void BtEdit_Click(object sender, RoutedEventArgs e)
        {
            if (dgvAuthors.SelectedItem == null)
            {
                MessageBox.Show("Select an author to modify", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            AddEditAuthor editWindow = new AddEditAuthor((Author)dgvAuthors.SelectedItem);

            editWindow.ShowDialog();

            if (editWindow.DialogResult == true)
            {
                if (authorModel.EditAuthor(editWindow.GetSelectedAuthor()))
                {
                    MessageBox.Show("Author was modified successfuly", "Success", MessageBoxButton.OK, MessageBoxImage.Information);
                    refreshAuthors();
                }
            }
        }