For ASP.NET Identity 2.0:
Does anybody know how to get "all users that have a given claim assigned"?
Let's say I have a claim with type="ArticleId" and value="1".
How can I get all users that have this claim? I really couldn't figure it out .. so, thanks for any help!!
Check this one.
var userContext = new ApplicationDbContext();
var users = userContext.Users.ToList(); Or
var users = UserManager.Users.ToList();
var userfilter = users.Where(u => u.Claims.Any(t => t.ClaimType == "ArticleId" && t.ClaimValue == "1"));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With