close

 

編號 函式型別名稱 回傳方法 展示網址
1 ViewResult

View()

new ViewResult()

https://youtu.be/8aGJ8-gDERM
2 JavaScriptResult

Jacascript()

https://youtu.be/c4USf1yIpkU
3 ContentReuslt Content() https://youtu.be/0dSPD6FoSnA
4 FileResult File() https://youtu.be/3_dLaiXKr_s
5 JsonResult Json() https://youtu.be/9VgA1Ba2Vhs
6 EmptyResult new EmptyResult() https://youtu.be/mVWmlMMbcXY
7 HttpStatusCodeResult new HttpStatusCodeResult() https://youtu.be/Y0hvGtiXSuE
8 RedirectResult new RedirectResult() https://youtu.be/-iCSMkKRpnw
9 RedirectToRouteResult RedirectToAction() https://youtu.be/mvY-COTNMh4

 

1、[ ViewResult ]

[解說]

visual studio 2015 預設都會產生第一種,也較為常人所用。(三種效果都相同)

(1) 函式型別 ActionResult , 回傳為  View()

[ASP.NET MVC] ActionResult 回傳值型別_ViewResult_1.png

(2) 函式型別 ActionResult , 回傳為  ViewResult()

[ASP.NET MVC] ActionResult 回傳值型別_ViewResult_2.png

(3) 函式型別 ViewResult , 回傳為  ViewResult()

[ASP.NET MVC] ActionResult 回傳值型別_ViewResult_3.png

 

2、[ JavaScriptResult ]

(1) 函式型別 ActionResult , 回傳為  JavaScript() - 型別通用型

[ASP.NET MVC] ActionResult 回傳值型別_JavaScript_1.png

(2) 函式型別 JavaScriptResult , 回傳為  JavaScript() - 限制JavaScript

[ASP.NET MVC] ActionResult 回傳值型別_JavaScript_2.png

3、[ ContentResult ]

(1) 函式型別 ActionResult , 回傳為  Content(  "html內容" ,"text/html" ) - 型別通用型

[ASP.NET MVC] ActionResult 回傳值型別_ContentResult_1.png

(2) 函式型別 ContentResult , 回傳為  Content(  "html內容" ,"text/html" ) - 

[ASP.NET MVC] ActionResult 回傳值型別_ContentResult_2.png

(3) 展示效果

[ASP.NET MVC] ActionResult 回傳值型別_ContentResult_3.png

4、[ FileResult ]

(1) 函式型別 ActionResult , 回傳為  File(iStream, "application/zip", fileName) - 型別通用型

[ASP.NET MVC] ActionResult 回傳值型別_FileResult_1.png

(2) 函式型別 FileResult , 回傳為  File(iStream, "application/zip", fileName) - 

[ASP.NET MVC] ActionResult 回傳值型別_FileResult_2.png

4、[ JsonResult ]

 

(1) 函式型別 ActionResult , 回傳為  Json(new {  tempList = tempList }, "text/json"  , JsonRequestBehavior.AllowGet) - 型別通用型

[ASP.NET MVC] ActionResult 回傳值型別_JsonResult_1.png

(2) 函式型別 JsonResult , 回傳為  Json(new {  tempList = tempList }, "text/json"  , JsonRequestBehavior.AllowGet) - 

[ASP.NET MVC] ActionResult 回傳值型別_JsonResult_2.png

6、[ EmptyResult ]

(1) 函式型別 ActionResult , 回傳為  new EmptyResult() - 型別通用型

[ASP.NET MVC] ActionResult 回傳值型別_EmptyResult_1.png

(2) 函式型別 EmptyResult , 回傳為  new EmptyResult() - 

[ASP.NET MVC] ActionResult 回傳值型別_EmptyResult_2.png

(3) 呈現畫面

[ASP.NET MVC] ActionResult 回傳值型別_EmptyResult_3.png

7、[HttpStatusCodeResult]

(1) 函式型別 ActionResult , 回傳為  new HttpStatusCodeResult() - 型別通用型

[ASP.NET MVC] ActionResult 回傳值型別_HttpStatusCodeResult_1.png

(2) 函式型別 HttpStatusCodeResult , 回傳為  new HttpStatusCodeResult() -

[ASP.NET MVC] ActionResult 回傳值型別_HttpStatusCodeResult_2.png

(3) 呈現畫面

[ASP.NET MVC] ActionResult 回傳值型別_HttpStatusCodeResult_3.png

8、[ RedirectResult ]

(1) 函式型別 ActionResult , 回傳為  new RedirectResult() - 型別通用型

[ASP.NET MVC] ActionResult 回傳值型別_RedirectResult_1.png

(2) 函式型別 RedirectResult , 回傳為  new RedirectResult() - 

[ASP.NET MVC] ActionResult 回傳值型別_RedirectResult_2.png

(3)畫面呈現 

[導頁前]

[ASP.NET MVC] ActionResult 回傳值型別_RedirectResult_3.png

[導頁後]

[ASP.NET MVC] ActionResult 回傳值型別_RedirectResult_4.png

9、[ RedirectToRouteResult ]

(1) 函式型別 ActionResult , 回傳為  RedirectToAction() - 型別通用型

[ASP.NET MVC] ActionResult 回傳值型別_RedirectToRouteResult_1.png

(2) 函式型別 RedirectToRouteResult, 回傳為  RedirectToAction() - 

[ASP.NET MVC] ActionResult 回傳值型別_RedirectToRouteResult_2.png

(3)畫面呈現 

[導頁前]

[ASP.NET MVC] ActionResult 回傳值型別_RedirectToRouteResult_3.png

[導頁後]

[ASP.NET MVC] ActionResult 回傳值型別_RedirectToRouteResult_4.png

arrow
arrow

    米拉尤咕 發表在 痞客邦 留言(0) 人氣()