15.6.2 Defining Optional URL Segments; Listinig 15-20. Checking for an Optional Segment Variable in the HomeController.cs File

This commit is contained in:
Jason Zhu 2021-11-24 18:47:39 +11:00
parent e43c56e68a
commit ed932d419f

View File

@ -20,7 +20,7 @@ namespace UrlsAndRoutes.Controllers
{
ViewBag.Controller = "Home";
ViewBag.Action = "CustomVariable";
ViewBag.CustomVariable = id;
ViewBag.CustomVariable = id ?? "<no value>";
return View();
}
}