I am trying to create routes for a resource with an array of homogeneous parameters.
The URL will look like this: products / categories / {categoryId1} / {categoryId2} /.../ brand / {brandID1} / {brandID2} / ...
And I would like the action method to look like this: public ActionResult GetProducts (IList categoryID, ILIsts brandID) {...}
where category and brand are independent filters.
I found a solution for a similar problem: ASP.NET MVC 2 parameter array
And I wonder if there is a more beautiful solution to use this prototype public ActionResult GetProducts (IList categoryID)
instead of public ActionResult myAction (string url)
for action method
- to avoid line separation and casting?
And how can I satisfy this solution for my case?
Thanks to everyone in advance!
source share