My two links to filter:
@Html.ActionLink("Customer 1", "Index", new { customer = 1 })
@Html.ActionLink("Project A", "Index", new { project = "A" })
My Controller with filtering:
public ViewResult Index(int? customer, int? project) {
var query = ...
if (customer != null) {
query = query.Where(o => o.CustomerID == customer);
}
if (project != null) {
query = query.Where(o => o.ProjectID == project);
}
return View(query.ToList());
}
I can now filter on either customer or project but not on both at the same time!
If I click Customer 1, url = Object?customer=1
If I click Project A, url = Object?project=a
I would like to be able to first click Customer 1 and then Project A and get url = Object?customer=1&project=a
Is this possible or should I do it in another way?
Thanks!