0

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

urlreader
  • 6,319
  • 7
  • 57
  • 91

1 Answers1

1

Use the built-in Roles.GetUsersInRole method.

var usersInRole = Roles.GetUsersInRole("Admin");

References:

Community
  • 1
  • 1
NightOwl888
  • 55,572
  • 24
  • 139
  • 212