【发布时间】:2016-11-29 11:26:35
【问题描述】:
我知道actionresult是ViewResult、JsonResult等继承的基类,但我想知道什么情况下可以直接调用ActionResult。
【问题讨论】:
标签: c# asp.net asp.net-mvc asp.net-mvc-4
我知道actionresult是ViewResult、JsonResult等继承的基类,但我想知道什么情况下可以直接调用ActionResult。
【问题讨论】:
标签: c# asp.net asp.net-mvc asp.net-mvc-4
当需要根据条件返回结果时
public ActionResult TestAction()
{
if(true)
return View();
else
Json(anyObject);
}
【讨论】: