Reputation: 109
I know how to get the users in role
_userManager.GetUsersInRoleAsync("RequiredRole");
but how to find users with a part of the string? Thanks in advance for your help.
Upvotes: 0
Views: 97
Reputation: 30016
You could query the ApplicationUser
list like below:
var usersInRole = _userManager.GetUsersInRoleAsync("Test").Result;
if(usersInRole.Count>0)
{
//replace u.UserName if you need other logic
var users = usersInRole.Where(u => u.Email.Contains(u.UserName)).ToList();
}
Upvotes: 1