routing - what is the best way to create an asp.net mvc controller action with lots of variables -
i have url
http://www.mysite.com/runreport
and controller action:
[compressfilter] public actionresult runreport(int field1, int field2, int field3, int field4, int field5, int field6, . . .)
so run query filter, wind of having this:
http://www.mysite.com/runreport/0/0/0/0/0/1/0. . . .
is there better way of doing without such ugly url , routing?
i want able have persistent url maps specific queries.
you don't have have these fields in route. can have them in query string so:
runreport?field3=1
you can combine them poco class so
public class mymodel { int? field1 { get; set; } int? field2 { get; set; } int? field3 { get; set; } }
this makes fields optional , model class can have smarts in too, can determine report want run example.
and controller action
public actionresult runreport(mymodel model)
this work either or post (or whatever other verb want use
Comments
Post a Comment