Refactor pet action management: rename PetAction to PetBasicAction, update related properties and methods, and enhance pet stats with maximum values.
This commit is contained in:
@@ -45,11 +45,20 @@ namespace pet_companion_api.Repositories
|
||||
return pet;
|
||||
}
|
||||
|
||||
public Pet UpdatePetAction(Pet pet)
|
||||
public Pet UpdatePetBasicAction(Pet pet)
|
||||
{
|
||||
context.Pets.Attach(pet);
|
||||
context.Entry(pet).Property(p => p.PetAction).IsModified = true;
|
||||
context.Entry(pet).Property(p => p.ActionSince).IsModified = true;
|
||||
context.Entry(pet).Property(p => p.PetBasicAction).IsModified = true;
|
||||
context.Entry(pet).Property(p => p.BasicActionCooldown).IsModified = true;
|
||||
context.SaveChanges();
|
||||
return pet;
|
||||
}
|
||||
|
||||
public Pet UpdatePetGatherAction(Pet pet)
|
||||
{
|
||||
context.Pets.Attach(pet);
|
||||
context.Entry(pet).Property(p => p.PetGatherAction).IsModified = true;
|
||||
context.Entry(pet).Property(p => p.GatherActionSince).IsModified = true;
|
||||
context.SaveChanges();
|
||||
return pet;
|
||||
}
|
||||
@@ -58,7 +67,7 @@ namespace pet_companion_api.Repositories
|
||||
{
|
||||
context.Pets.Attach(pet);
|
||||
context.Entry(pet).Reference(p => p.Resources).IsModified = true;
|
||||
context.Entry(pet).Property(p => p.ActionSince).IsModified = true;
|
||||
context.Entry(pet).Property(p => p.GatherActionSince).IsModified = true;
|
||||
context.SaveChanges();
|
||||
return pet;
|
||||
}
|
||||
|
Reference in New Issue
Block a user