From 8f67d3f2999dc9b621094caeefa4370ec83aaa1b Mon Sep 17 00:00:00 2001 From: "jason.zhu" Date: Tue, 22 Jun 2021 14:47:40 +1000 Subject: [PATCH] Finished Chapt2: Controllers --- MvcMusicStore/Controllers/HomeController.cs | 6 ++++++ MvcMusicStore/MvcMusicStore.csproj | 1 + MvcMusicStore/Views/Home/Sample.cshtml | 17 +++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 MvcMusicStore/Views/Home/Sample.cshtml diff --git a/MvcMusicStore/Controllers/HomeController.cs b/MvcMusicStore/Controllers/HomeController.cs index 6226311..449200c 100644 --- a/MvcMusicStore/Controllers/HomeController.cs +++ b/MvcMusicStore/Controllers/HomeController.cs @@ -26,5 +26,11 @@ namespace MvcMusicStore.Controllers return View(); } + + public ActionResult Sample() + { + ViewBag.Message = "Hello World. Welcome to ASP.NET MVC!"; + return View("Sample"); + } } } \ No newline at end of file diff --git a/MvcMusicStore/MvcMusicStore.csproj b/MvcMusicStore/MvcMusicStore.csproj index defea00..d35f5e1 100644 --- a/MvcMusicStore/MvcMusicStore.csproj +++ b/MvcMusicStore/MvcMusicStore.csproj @@ -163,6 +163,7 @@ + diff --git a/MvcMusicStore/Views/Home/Sample.cshtml b/MvcMusicStore/Views/Home/Sample.cshtml new file mode 100644 index 0000000..d72ae1c --- /dev/null +++ b/MvcMusicStore/Views/Home/Sample.cshtml @@ -0,0 +1,17 @@ + +@{ + ViewBag.Title = "Sample"; +} + + + +Sample View + +

+ This is sample view. It's not much to look at, + but it gets the job done. +

+ + + +