29 lines
583 B
C#
29 lines
583 B
C#
namespace PetCompanion.Models
|
|
{
|
|
public class Inventory
|
|
{
|
|
public List<Item> Items { get; set; } = new();
|
|
public int Capacity { get; set; }
|
|
|
|
public bool AddItem(Item item)
|
|
{
|
|
if (Items.Count < Capacity)
|
|
{
|
|
Items.Add(item);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public bool RemoveItem(Item item)
|
|
{
|
|
return Items.Remove(item);
|
|
}
|
|
|
|
public void TrashItem(Item item)
|
|
{
|
|
RemoveItem(item);
|
|
}
|
|
}
|
|
}
|