From 483fe19002e344211e69ba72eb81d48a3031c029 Mon Sep 17 00:00:00 2001 From: "jason.zhu" Date: Thu, 10 Jun 2021 15:48:05 +1000 Subject: [PATCH] Finished 'Views in ASP.NET MVC Application' --- FirstMVCDemo/Controllers/HomeController.cs | 4 ++-- FirstMVCDemo/FirstMVCDemo.csproj | 2 +- FirstMVCDemo/Views/Home/Index.cshtml | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 FirstMVCDemo/Views/Home/Index.cshtml diff --git a/FirstMVCDemo/Controllers/HomeController.cs b/FirstMVCDemo/Controllers/HomeController.cs index 94c28dc..fd52f67 100644 --- a/FirstMVCDemo/Controllers/HomeController.cs +++ b/FirstMVCDemo/Controllers/HomeController.cs @@ -9,9 +9,9 @@ namespace FirstMVCDemo.Controllers public class HomeController : Controller { // GET: Home - public string Index(string id, string name) + public ActionResult Index() { - return "Id = " + id + ", Name = " + Request.QueryString["name"]; + return View(); } } } \ No newline at end of file diff --git a/FirstMVCDemo/FirstMVCDemo.csproj b/FirstMVCDemo/FirstMVCDemo.csproj index 1aec46e..1cd21ab 100644 --- a/FirstMVCDemo/FirstMVCDemo.csproj +++ b/FirstMVCDemo/FirstMVCDemo.csproj @@ -102,6 +102,7 @@ + Web.config @@ -112,7 +113,6 @@ - 10.0 diff --git a/FirstMVCDemo/Views/Home/Index.cshtml b/FirstMVCDemo/Views/Home/Index.cshtml new file mode 100644 index 0000000..2c27dc6 --- /dev/null +++ b/FirstMVCDemo/Views/Home/Index.cshtml @@ -0,0 +1,18 @@ + +@{ + Layout = null; +} + + + + + + + Index + + +
+

Index View Coming From Views/Home Folder

+
+ +