I'm looking for a way to convert a mvc4 model to querystring. The built-in mechanism of mvc4 is allowing me to do something like this:
@Url.Action("SearchWithQueryString","Search", new {@Title = "Title", @Author= " Author", @Date = "date"})
The result of this command is:
Url/Search/SearchWithQueryString?Title=title&Author=author&date=date
My goal is to pass a poco model and get the same result. for example, if I have this class:
public class Test
{
public string Title {get;set;}
public string Author {get;set;}
public string Date {get;set;}
}
I want to be able to do something like this with using the built-in mechanism:
@Url.Action("SearchWithQueryString","Search", new Test())
and get the same result as I got previously.
Any ideas?