Using MVCContrib you can easily do RedirectToAction calls such as
this.RedirectToAction( c => c.List() );
where List is an action result in said controller. Is there a way to do the same but using the “View” method instead? I.E
this.View( c => c.List(), viewModel );
Here’s a trivial but complete example:
[HttpGet]
public ActionResult Profile()
{
return View( new ProfileViewModel() )
}
[HttpPost]
public ActionResult Profile( ProfilePostModel postModel )
{
if( !ModelState.IsValid )
return this.View( c => c.Profile(), postModel.MapToViewModel() );
_service.Save(postModel.MapToDtoObject() );
return this.RedirectToAction( c => c.SomeOtherAction() );
}
I’ve been searching around and haven’t found anything relevant.. Thanks!
I don’t know if such method exists in MVCContrib but it would be trivial to write one: