Reputation: 479
I need to POST a register model from another model without showing the register model to the user in MVC 4. Please suggest.
Upvotes: 1
Views: 861
Reputation: 1938
Maybe is not the best approach, but you can put the model in hiddenfields
TempData example:
On redirecting Action:
TempData["model"] = model;
return RedirectToAction("DifferentAction");
On different Action
var myModel = (model)TempData["model"]
/* do register stuff */
Upvotes: 0
Reputation: 4339
Move your business logic out of the actions and into methods. Let your actions call those to do their work. Then instead of trying to abuse the framework to post data between actions, just call the method with the parameters you have.
Upvotes: 2
Reputation: 190925
I would store it in temp data and redirect instead of re-POSTing.
Upvotes: 0