private void RemoveBtn_Click(object sender, EventArgs e) { Book book = new Book(); var selectedItems = BookCatalogLV.SelectedItems; if (selectedItems.Count == 1) { book = itemToBook(selectedItems[0]); } _adminPresenter.RemoveBook(book); MessageBox.Show("Book successfully removed!"); BookCatalogLV.Refresh(); }
private void LoanBtn_Click(object sender, EventArgs e) { int bookId = 0; var selectedItem = BookCatalogLV.SelectedItems; if (selectedItem.Count == 1) { bookId = Convert.ToInt32(selectedItem[0].SubItems[0].Text); } var success = _bookPresenter.Loan(bookId, _username); if (success) { MessageBox.Show("Book successfully loaned"); } else { MessageBox.Show("Book has been borrowed or reserved!"); } BookCatalogLV.Refresh(); }