Reputation: 31
I am new to ASP.NET MVC programming. I would want to know what does the return View(model) does.
public ActionResult CreateProducts(ProductsModel model)
{
/// Some code here.
return View(model);
}
Upvotes: 0
Views: 5455
Reputation: 1118
When you hit the URL, something like http://blah-blah/Products/CreateProducts
,
a controller(Product controller in this case) object is created and initialized.
This controller contains the action method CreateProducts
which is called via the above url.
The controller's job is to bind the Model and the View and render it as HTML in the Browser.
This is precisely done by the View(model)
method.
Hope it helps..
Upvotes: 1
Reputation: 14669
It will return View (html page) with Name "CreateProducts" and controller pass ProductsModel data in "model", which will use to bind with render html.
Upvotes: 1