/// <summary> /// Chooses a book to add to your book bag /// </summary> /// <param name="title">Title of the book of choice</param> public static void BorrowBook(string title) { int counter = 0; foreach (Book b in Library) { if (b.Title == title) { BookBag.Add(b); Library.Remove(counter); } counter++; } }
/// <summary> /// Removes the book from the Library and adds it to the BookBag which represents it being borrowed and no longer available /// </summary> /// <param name="title">The title of the book being borrowed</param> /// <returns>The borrowed book</returns> public static Book Borrow(string title) { Book borrowed = null; foreach (Book book in Library) { if (book.Title == title) { borrowed = book; BookBag.Add(book); Library.Remove(borrowed); } } return(borrowed); }