Is there a way to populate a dynamic object with query string parameters?
This is so that my search parameters in QS can change without binding them directly to the container object or changing the signature of the search method.
eg.
Incoming URL: www.test.com/Home/Search?name=john&product=car&type=open&type=all
public ActionResult Search()
{
dynamic searchParams =
var model = getResults(searchParams);
return View(model);
}
The populated searchParams object should look like this:
{
name = "john",
product = "car",
type = { "open", "all" }
}
Any ideas?
source
share