Fixed some user deletion issues

This commit is contained in:
Marcel Baumgartner 2023-10-29 17:51:47 +01:00
parent aa501244e1
commit ee9190447f
2 changed files with 5 additions and 2 deletions

View file

@ -75,7 +75,7 @@ public class ServiceAdminService
await Actions[service.Product.Type].Delete(scope.ServiceProvider, service);
foreach (var share in service.Shares)
foreach (var share in service.Shares.ToArray())
{
serviceShareRepo.Delete(share);
}

View file

@ -104,6 +104,9 @@ public class UserDeleteService
TransactionRepository.Delete(transaction);
// User
UserRepository.Delete(user);
// We need to use this in order to entity framework not crashing because of the previous deleted data
var userToDelete = UserRepository.Get().First(x => x.Id == user.Id);
UserRepository.Delete(userToDelete);
}
}