using System.Collections.Generic; namespace Bücherwurm { class Inventory { private List InventoryList {get; set;} private int NextId {get; set;} public Inventory(){ InventoryList = new List(); NextId = 1; } public void Add(Book Book) { InventoryList.Add(new Item(NextId, Book.BookId)); NextId = NextId + 1; } public void Add(int BookId) { InventoryList.Add(new Item(NextId, BookId)); NextId = NextId + 1; } public void Remove(int Id) { InventoryList.RemoveAll(item => item.ItemId == Id); } public void BookRemove(int BookId) { InventoryList.RemoveAll(item => item.BookId == BookId); } public List GetInventory() { return InventoryList; } public bool IsInInventory(int Id) { return (InventoryList.Find(item => item.ItemId == Id) != null); } public bool isAvailable(int Id) { return (InventoryList.Find(item => item.ItemId == Id && item.Status == StatusEnum.Available) != null); } } }