Buecherwurm/Inventory.cs

27 lines
563 B
C#
Raw Normal View History

2020-04-23 12:47:50 +00:00
using System.Collections.Generic;
namespace Bücherwurm
{
class Inventory
{
private List<Item> InventoryList {get; set;}
2020-04-23 13:44:38 +00:00
private int NextId {get; set;}
2020-04-23 12:47:50 +00:00
public Inventory(){
InventoryList = new List<Item>();
2020-04-23 13:44:38 +00:00
NextId = 0;
2020-04-23 12:47:50 +00:00
}
public void Add(Book Book)
{
2020-04-23 13:44:38 +00:00
InventoryList.Add(new Item(NextId, Book.BookId));
NextId = NextId++;
2020-04-23 12:47:50 +00:00
}
public void Remove(int Id)
{
2020-04-23 13:44:38 +00:00
InventoryList.RemoveAll(item => item.ItemId == Id);
2020-04-23 12:47:50 +00:00
}
}
}