Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        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();
        }