private void ByAuthorButton_Click(object sender, EventArgs e) { Author author = Author_listBox.SelectedItem as Author; ShowAllBooks(bookService.BooksByAuthor(author)); ShowAllBookCopies(bookCopyService.BooksByAuthor(author)); }
/// <summary> /// Checks if an author has been chosen in the listbox and then shows books by author. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSortByAuthor_Click(object sender, EventArgs e) { Author auth = lbAuthors.SelectedItem as Author; if (lbAuthors.SelectedIndex == -1) { MessageBox.Show("Please choose an author."); } else { ShowAllBooks(bookService.BooksByAuthor(auth.Id), lbBooks); } }