Reputation: 6615
I'm using SimpleMembership in MVC4 with Entity Framework. When create edmx, for some reasons, the table webpages_UsersInRoles does not generate class (probably it is because this table is only an association).
Now, how can I get a list users that are in a Role, i.e. All admins?
Or, I have to get all users, then check whether each is in the Admin role?
Thanks
Upvotes: 0
Views: 479
Reputation: 56909
Use the built-in Roles.GetUsersInRole
method.
var usersInRole = Roles.GetUsersInRole("Admin");
References:
Upvotes: 1