ActionResult inherited IActionResult
JsonResult, RedirectResult, FileResult, ViewResult, ContentResult have inherited ActionResult
So IActionResult type of function can return all direct and indirect inherit his inheritance data types
And each supports two data return method
1、JsonResult
public IActionResult Result1 () // instantiate the object { a JsonResult Result = new new a JsonResult ( new new {name = " kxy1 " }); return Result; } public IActionResult Result2 () // encapsulation method { return Json ( new new {name = " kxy2 " }); }
2、RedirectResult
return Redirect("Index");
3, the File Hunger
4、ViewResult