Reputation: 71
Am using MVC4 SimpleMemebership in my application ..Am retrieving a list of all user in certain role using this :
public ActionResult Index()
{
var s = Roles.GetUsersInRole("Admin");
var m = Roles.GetUsersInRole("Member");
return View(s);
you can see am passing the s list so am Only getting the user who have " Admin"Role. I want to have list of all user in (Admine and Memeber) in my list how to do that ?
Upvotes: 1
Views: 623
Reputation: 5817
There is no method for that. Maybe you could do intersection with Linq:
var s = Roles.GetUsersInRole("Admin").Intersect(Roles.GetUsersInRole("Member");
Upvotes: 2
Reputation: 11606
You have to combine both results, first. Of course one user can be in multiple rules so you might get duplicate results which you have to eliminate then. You can do this using Linq:
return View(s.Union(m).Distinct());
Upvotes: 1