Skip to content

Commit

Permalink
fix: Essential race traits deleted with character #38
Browse files Browse the repository at this point in the history
  • Loading branch information
KrystianKempski committed Nov 16, 2024
1 parent fa28ad0 commit ebd8ef5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions DA_Business/Repository/CharacterReps/CharacterRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public async Task<int> Delete(int id)
using var contex = await _db.CreateDbContextAsync();
//delete traits adv
var obj = await contex.Characters.Include(c=>c.EquipmentSlots).ThenInclude(e=>e.Equipment).ThenInclude(t=>t.Traits).FirstOrDefaultAsync(u => u.Id == id);
var traits = contex.TraitsCharacter.Where(c=>c.CharacterId == id);
var traits = contex.TraitsCharacter.Where(c=>c.CharacterId == id && c.TraitApproved == false);
foreach(var trait in traits)
{
contex.TraitsCharacter.Remove(trait);
Expand All @@ -80,7 +80,7 @@ public async Task<int> Delete(int id)
if (race is not null)
{
if (!race.Traits.IsNullOrEmpty())
race.Traits.ToList().ForEach(t =>contex.TraitsRace.Remove(t));
race.Traits.Where(t=>t.TraitApproved==false).ToList().ForEach(t =>contex.TraitsRace.Remove(t));
contex.Races.Remove(race);
}
//delete equipment slots
Expand Down

0 comments on commit ebd8ef5

Please sign in to comment.