public void CheckoutBook()
        {
            System.Console.WriteLine("Enter the number of the book you'd like to checkout.");
            ViewBooks(AvailableBooks);
            Book bookToCheckout = ValidateUserInput(AvailableBooks);

            if (bookToCheckout == null)
            {
                return;
            }
            bookToCheckout.Available = false;
            AvailableBooks.Remove(bookToCheckout);
            CheckedOutBooks.Add(bookToCheckout);
            System.Console.WriteLine($"Enjoy your copy of {bookToCheckout.Title}.");
        }
Example #2
0
        public void CheckOutBooks()
        {
            System.Console.WriteLine("Enter the number of the book that you'd like to check out: ");
            ViewBooks(AvailableBooks);
            Book bookToCheckOut = ValidateUserInput(AvailableBooks);

            if (bookToCheckOut == null)
            {
                return;
            }
            bookToCheckOut.Available = false;
            AvailableBooks.Remove(bookToCheckOut);
            CheckedOutBooks.Add(bookToCheckOut);
            System.Console.WriteLine("We hope that you enjoy {0}", bookToCheckOut.Title);
        }
        public void Checkout(string selection)
        {
            Book selectedBook = ValidateBook(selection, AvailableBooks);

            if (selectedBook == null)
            {
                Console.Clear();
                System.Console.WriteLine(@"Invalid Selection");
                return;
            }
            selectedBook.Available = false;
            AvailableBooks.Remove(selectedBook);
            CheckedOut.Add(selectedBook);
            System.Console.WriteLine("Congrats my dude, you go it");
        }
Example #4
0
        // CHECKOUT BOOK
        public void CheckoutBook(string selection)
        {
            Book selectedBook = ValidateBook(AvailableBooks, selection);

            if (selectedBook == null)
            {
                Console.WriteLine(" Invalid Selection");
                return;
            }
            else
            {
                selectedBook.Available = false;
                CheckedOut.Add(selectedBook);
                AvailableBooks.Remove(selectedBook);
                Console.WriteLine(" Check out successful!");
            }
        }
Example #5
0
        public void CheckoutBook(string input)
        {
            Book selectedBook = ValidateBook(input, AvailableBooks);

            if (selectedBook == null)
            {
                Console.Clear();
                System.Console.WriteLine("Invalid Selection... Press enter to continue");
                Console.ReadLine();
                return;
            }
            //set available to false, add book to checked out and remove from available array
            selectedBook.Available = false;
            CheckedOutBooks.Add(selectedBook);
            AvailableBooks.Remove(selectedBook);
            Console.Clear();
            System.Console.WriteLine($"Enjoy {selectedBook.Title}");
        }
Example #6
0
        //The checkout method removes a book from Books, marks it as no long available, and moves it to CheckedOut
        public void Checkout(string selection)
        {
            Book selectedBook = ValidateUserSelection(selection, AvailableBooks);

            if (selectedBook == null)
            {
                Console.Clear();
                System.Console.WriteLine(@"Invalid Selection
                        ");
                return;
            }
            selectedBook.Available = false;
            CheckedOut.Add(selectedBook);
            AvailableBooks.Remove(selectedBook);
            Console.Clear();
            System.Console.WriteLine(@"Enjoy your Book!
                   ");
        }
Example #7
0
        public void Checkout(string selection)
        {
            Book selectedBook = ValidateBook(selection, AvailableBooks);

            if (selectedBook == null)
            {
                Console.Clear();
                System.Console.WriteLine(@"Invalid Selection
                ");
                return;
            }
            int index = Int32.TryParse(selection, out bookIndex);

            if (index < checkedOut.Count)
            {
                Book book = checkedOut[index];
                selectedBook.Available = false;
                AvailableBooks.Remove(book);
                checkedOut.Add(book);
                System.Console.WriteLine($"You Gots a {selectedBook.Title}");
            }
        }