Question

I'm trying to return two RedirectToAction so I can render two pages if the conditions are met, or one if not. But every time I try to do this it stops at first return and ignore the other one. Is there a simple way of returning two actions from a single controller?

public ActionResult Create(ViewModel viewModel) {   
....    
if (supplier.Printed)
{
    return RedirectToAction("ViewDocument", "Damages", new { id = item.Id, forEmailAttachment = false });
}
return RedirectToAction("Index", new { id = viewModel.Id }); }

Any ideas?

Was it helpful?

Solution

There is not a way to return more than one redirect. It wouldn't make sense, as one redirect would be processed right after the other, resulting in only the final redirect being effective.

If you want to incorporate two pages into one, you can use partial views.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top