Permalink
Browse files

add a display template for the user view model used in the show view

  • Loading branch information...
darind committed Feb 20, 2011
1 parent 978c6b0 commit c09c666d25a0ac54d3e3013f35b2d2a840434184
@@ -90,6 +90,7 @@
<Content Include="Config\repositories.xml" />
<Content Include="Config\sessionFactory.xml" />
<Content Include="Global.asax" />
+ <Content Include="Views\Shared\DisplayTemplates\UserViewModel.cshtml" />
<None Include="Views\Users\Edit.cshtml" />
<None Include="Views\Users\Index.cshtml" />
<None Include="Views\Users\New.cshtml" />
@@ -0,0 +1,17 @@
+@model SampleMvc.Web.Models.UserViewModel
+
+<fieldset>
+ <legend>Fields</legend>
+
+ <div class="display-label">Id</div>
+ <div class="display-field">@Html.DisplayFor(x => x.Id)</div>
+
+ <div class="display-label">FirstName</div>
+ <div class="display-field">@Html.DisplayFor(x => x.FirstName)</div>
+
+ <div class="display-label">LastName</div>
+ <div class="display-field">@Html.DisplayFor(x => x.LastName)</div>
+
+ <div class="display-label">Age</div>
+ <div class="display-field">@Html.DisplayFor(x => x.Age)</div>
+</fieldset>
@@ -6,22 +6,7 @@
<h2>Show</h2>
-<fieldset>
- <legend>Fields</legend>
-
- <div class="display-label">Id</div>
- <div class="display-field">@Html.DisplayFor(x => x.Id)</div>
-
- <div class="display-label">FirstName</div>
- <div class="display-field">@Html.DisplayFor(x => x.FirstName)</div>
-
- <div class="display-label">LastName</div>
- <div class="display-field">@Html.DisplayFor(x => x.LastName)</div>
-
- <div class="display-label">Age</div>
- <div class="display-field">@Html.DisplayFor(x => x.Age)</div>
-
-</fieldset>
+@Html.DisplayForModel()
<p>
@(Html.ActionLink<UsersController>(c => c.Edit(Model.Id), "Edit")) |
@(Html.ActionLink<UsersController>(c => c.Index(), "Back to List"))

0 comments on commit c09c666

Please sign in to comment.