Let's say I have two create action methods, one for get method, one for post method:
[HttpGet]
public ActionResult Create()
{
return View();
}
[HttpPost]
public ActionResult Create()
{
return View();
}
If I just add a view to Get method, so there is no view for Post action method, so when I invoke the post method of Create, why I still get the view that belongs to the get method?
When you create a View from a method, this view belongs to all methods with the same name and that share the same class. If you want to call another view (In this case, from the post method), just use
return View("nameOfTheView");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With