asp.net mvc - MVC 5 RouteConfig trouble -
i have such action:
[objectrequired] public actionresult campaign(int? id, someclass object = null) { ... }
what need route action:
a) int parameter (.../campaign/12345)
b) no parametes (optionally) (.../campaign)
mvc error says, there no nonparametric constructor (if delete "object" parameter - it's ok). cant delete "object" parameter, because need check values , pass value [objectrequired] attribute this:
filtercontext.actionparameters["object"] = _someobject;
i don't want use constructions viewdata. where's right way?
i'm not 100% on i'm i'll if am...
you can't pass object through get. pass parameters , use custom route handler build object you.
you hold object in data , use entity framework model.
you use tempdata, that's similar viewdata.
you hold in session.
Comments
Post a Comment