My problem is that I give to my action 3 parameters (category, city, page) and some of them could be null because I need to make 3 filterings:
- one by category
(category != null && city == null)
- one by city
(category == null && city != null)
- one by both of them
(category != null && city != null)
My problem is on routing.
When (category != null && city == null)
it doesn't work. It gives to category parameter from my action null value, and my city parameter receives the category's value.
My Global.asax:
routes.MapRoute(
"ListByCity",
"Advertisers/{city}/{page}",
new { controller = "Advertisers", action = "List" }
);
routes.MapRoute(
"ListByCategory",
"Advertisers/{category}/{page}",
new { controller = "Advertisers", action = "List" }
);
routes.MapRoute(
"List",
"Advertisers/{category}/{city}/{page}",
new { controller = "Advertisers", action = "List" }
);
Please help me.