This commit is contained in:
Loretta 2024-06-25 18:07:24 +02:00
parent 252b1a0f90
commit e32e6d2759
1 changed files with 8 additions and 1 deletions

View File

@ -49,7 +49,14 @@ public static class AcCompanyDbSetExtensions
{
if (!ctx.UserToCompanies.Any(x => x.UserId == company.OwnerId && x.ServiceProviderId == company.Id))
{
company.AddUser(ownerId.Value, 1);
var userToCompany = (Activator.CreateInstance(typeof(TUserToCompany)) as TUserToCompany)!;
userToCompany.Id = Guid.NewGuid();
userToCompany.ServiceProviderId = company.Id;
userToCompany.UserId = ownerId.Value;
userToCompany.Permissions = 1;
ctx.UserToCompanies.Add(userToCompany);
//company.AddUser(ownerId.Value, 1);
}
}