diff --git a/samples/MvcSample.Web/HomeController.cs b/samples/MvcSample.Web/HomeController.cs index 6bf0088cd8..07f1863756 100644 --- a/samples/MvcSample.Web/HomeController.cs +++ b/samples/MvcSample.Web/HomeController.cs @@ -17,6 +17,11 @@ namespace MvcSample.Web return View("MyView", CreateUser()); } + public IActionResult NullUser() + { + return View(); + } + public ActionResult ValidationSummary() { ModelState.AddModelError("something", "Something happened, show up in validation summary."); diff --git a/samples/MvcSample.Web/Views/Home/NullUser.cshtml b/samples/MvcSample.Web/Views/Home/NullUser.cshtml new file mode 100644 index 0000000000..fdd8a4d8ca --- /dev/null +++ b/samples/MvcSample.Web/Views/Home/NullUser.cshtml @@ -0,0 +1,42 @@ +@* + For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860 +*@ +@{ + // ViewBag.Title = "Home Page"; +} + +@using MvcSample.Web.Models +@model User + +
+
+ EditorForModel: + @Html.EditorForModel() +
+
+ Editor of empty string: + @Html.Editor("") +
+
+ EditorFor of identity expression: + @Html.EditorFor(m => m) +
+ +
+ DisplayForModel: + '@Html.DisplayForModel()' +
+ +
+ Display: + for name '@Html.Display("Name")' + and alive '@Html.Display("Alive")' +
+ +
+ Editor: + for name @Html.Editor("Name") + alive @Html.Editor("Alive") + and alive expression @Html.EditorFor(m => m.Alive) +
+
\ No newline at end of file