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(); } } }
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(); } } }