我想根據isCustomerEligible
的值將用戶發送到兩個不同頁面中的一個。當該變量的值設置爲false時,它會調用Index,但返回Customer
的視圖,而不是Index
的視圖。返回不同視圖ASP.NET MVC中的相同控制器
public ViewResult Index()
{
return View();
}
public ViewResult Customer()
{
DetermineCustomerCode();
DetermineIfCustomerIsEligible();
return isCustomerEligible ? View() : Index();
}
:第二個將無法工作的看法,行動的是返回類型應該是'ActionResult' –
那是什麼我算了一下,因此免責。我編輯了我的答案 – maccettura