0
Ricavir created
Hi,
I want to retrieve users that are included in, at least, one organization unit. I've looked to abp docs but didn't found.
Right now, I'm using following code :
//Find users in OU
foreach(var user in await UserManager.Users.ToListAsync())
{
if((await UserManager.GetOrganizationUnitsAsync(user)).Count() > 0)
{
employeeIds.Add(user.Id);
}
}
Can I achieve that in a more efficient way ?
2 Answer(s)
-
0
Hi @Ricavir,
You can find users in an organizaiton unit but there is no built-in method for your use case. You can write a custom repository or custom linq query to join "UserManager.Users" with "_organizationUnitRepository.GetAll()". Then, you can group it by user or you can distinct this list.
-
0
Thanks @ismcagdas