Refactor namespaces to follow new naming convention and add item model classes
This commit is contained in:
28
Models/Inventory.cs
Normal file
28
Models/Inventory.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
namespace Pet.Companion.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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user