asp.net mvc - RedirectToRoute with Parameters Objects -


I am in controller A and using redirect redirect to go into controller B, where I pass two object parameters But I keep these values ​​in mind, there are tap on redirection. Redirector does not allow root objects to pass ?????

Only the simple scalar can exceed the values ​​and not the complex objects. Example:

  Public Performance Index () {SomeModel Model ... ... Redirect Reaction ("Foo", New {Prop1 = model.Prop1, Prop2 = model.Prop2, Prop3 = model} .Prop3,}); } Public Action Rachelle Fu (some model models) {// Model. Prop. 1, model.prop2 and model 3.Prop3 will be bound correctly ...}   

Another possibility to continue the object is to pass your datastore and only relevant IDs :

  Public Performance Index () {SomeModel Model = ... String ID = Repository. Save (model); Return Redirect Tiection ("Foo", New {ID = ID}); } Public Action Result Foo (String ID) {// Fetch Model from Repository: Some ViewModel Models = Repository Load (id); ...}    

Comments