I have 2 POST actions, each one wants to redirect from one to another:
[HttpPost]
public IActionResult Foo()
{
bool isBar = handleFoo();
if (isBar) return RedirectToAction("Bar");
else return View();
}
[HttpPost]
public IActionResult Bar()
{
bool isFoo = handleBar();
if (isFoo) return RedirectToAction("Foo");
else return View();
}
Assumedly, the user submits a form and runs the Bar
method, if a boolean expression isFoo
is true, then return the Foo
method with its view, else return the current Bar
view.
Currently, my code cannot return the correct View for the action, how can I do it?