在另一個 ActionResult 中呼叫 ActionResult

我們可以在另一個動作結果中呼叫動作結果。

public ActionResult Action1()
{
    ViewData["OutputMessage"] = "Hello World";
    return RedirectToAction("Action2","ControllerName");
    //this will go to second action;
}

public ActionResult Action2()
{
    return View();
    //this will go to Action2.cshtml as default;
}