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}."); }
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"); }
// 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!"); } }
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}"); }
//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! "); }
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}"); } }