Reputation: 32808
I have:
[HttpPost]
public ActionResult Create(EditViewModel viewModel)
{
...
}
I know I can check the viewModel object when debugging but how can I get the actual HTTP response from within the controller at the "..." point?
Also how can I see the data that gets bound to the viewModel (without looking at the viewModel). Where's that data stored in the Response object?
Upvotes: 0
Views: 442
Reputation: 32437
If you add FormCollection as a parameter to your POST action method, MVC will populate it with the posted form data. Or through the Form property of the Request
[HttpPost]
public ActionResult Create(EditViewModel viewModel, FormCollection formCollection)
{
var name = formCollection["name"];
var email = Request.Form["email"];
}
But modifying it inside the controller violates the whole "MVC" pattern.
Upvotes: 1