inventory working :D

This commit is contained in:
2025-02-05 19:38:25 -03:00
parent 7a2c3d2f67
commit 5289910270
15 changed files with 174 additions and 468 deletions

View File

@@ -19,6 +19,8 @@ namespace PetCompanion.Repositories
.Where(p => p.UserId == userId)
.Include(p => p.Stats)
.Include(p => p.Resources)
.Include(p => p.Inventory)
.Include(p => p.EquippedItemsList)
.ToList();
}
@@ -28,6 +30,8 @@ namespace PetCompanion.Repositories
.Where(p => p.Id == petId && p.UserId == userId)
.Include(p => p.Stats)
.Include(p => p.Resources)
.Include(p => p.Inventory)
.Include(p => p.EquippedItemsList)
.FirstOrDefault();
}
@@ -41,6 +45,12 @@ namespace PetCompanion.Repositories
public Pet UpdatePet(Pet pet)
{
context.Pets.Update(pet);
if (pet.Inventory != null)
{
context.Inventories.Update(pet.Inventory);
}
context.SaveChanges();
return pet;
}