public void RemoveBook(Book book) { var booksToRemove = (from b in Books where b.Book.IsSameTitleAndAuthor(book) select b).ToList(); if (!booksToRemove.Any()) return; foreach (var wishListBook in booksToRemove) { Books.Remove(wishListBook); } }
public void AddBook(Book book) { var isBookAlreadyAdded = false; foreach (var wishListBook in Books) { isBookAlreadyAdded = wishListBook.Book.IsSameTitleAndAuthor(book); } if (!isBookAlreadyAdded) Books.Add(new WishListBook {Book = book}); }
public void BuysBook(Book book) { OwnedBooks.Add(book); }
public bool IsSameEdition(Book book) { return Title == book.Title && Author == book.Author && BookType == book.BookType; }
public bool IsSameTitleAndAuthor(Book book) { return Title == book.Title && Author == book.Author; }