diff --git a/chap3_your_first_mvc_app/PartyInvites/Controllers/HomeController.cs b/chap3_your_first_mvc_app/PartyInvites/Controllers/HomeController.cs index 2165da2..106c868 100644 --- a/chap3_your_first_mvc_app/PartyInvites/Controllers/HomeController.cs +++ b/chap3_your_first_mvc_app/PartyInvites/Controllers/HomeController.cs @@ -10,6 +10,8 @@ namespace PartyInvites.Controllers { public ActionResult Index() { + int hour = DateTime.Now.Hour; + ViewBag.Greeting = hour < 12 ? "Good morning" : "Good afternoon"; return View(); } diff --git a/chap3_your_first_mvc_app/PartyInvites/Views/Home/Index.cshtml b/chap3_your_first_mvc_app/PartyInvites/Views/Home/Index.cshtml index 09121c7..6104f79 100644 --- a/chap3_your_first_mvc_app/PartyInvites/Views/Home/Index.cshtml +++ b/chap3_your_first_mvc_app/PartyInvites/Views/Home/Index.cshtml @@ -10,7 +10,7 @@
- Hello, world (from the view) + @ViewBag.Greeting, world (from the view)
\ No newline at end of file