Finished Chapt2: Controllers

chap2
jason.zhu 2021-06-22 14:47:40 +10:00
parent ccba65247b
commit 8f67d3f299
3 changed files with 24 additions and 0 deletions

View File

@ -26,5 +26,11 @@ namespace MvcMusicStore.Controllers
return View();
}
public ActionResult Sample()
{
ViewBag.Message = "Hello World. Welcome to ASP.NET MVC!";
return View("Sample");
}
}
}

View File

@ -163,6 +163,7 @@
<Content Include="Views\Home\About.cshtml" />
<Content Include="Views\Home\Contact.cshtml" />
<Content Include="Views\Home\Index.cshtml" />
<Content Include="Views\Home\Sample.cshtml" />
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />

View File

@ -0,0 +1,17 @@

@{
ViewBag.Title = "Sample";
}
<!DOCTYPE html>
<html>
<head><title>Sample View</title></head>
<body>
<p>
This is sample view. It's not much to look at,
but it gets the job done.
</p>
</body>
</html>