I have a view that displays details about all users in the database, I need to be able to filter this and display only those users selected by an admin.
Currently the controller looks like this –
public ViewResult Index()
{
var trs = db.TRS
.Include(t => t.User);
return View(trs.ToList());
}
but i need to alter this query to only include the users selected. I have changed the controller like this –
public ViewResult Index(FormCollection form)
{
string[] UserIDs = form["TRSIDs"].Split(',');
var trs = db.TRS
.Include(t => t.User);
return View(trs.ToList());
}
And now I have an array containing all the USERIDs selected, is it possible to change the query to use these USERIDs so that the list sent will only contain the selected users?
Do you want something like this?