Skip to content

Instantly share code, notes, and snippets.

@seif
Created November 1, 2011 20:27
Show Gist options
  • Save seif/1331800 to your computer and use it in GitHub Desktop.
Save seif/1331800 to your computer and use it in GitHub Desktop.
S#harp Architecture wiki Simple CRUD Application Sample views
@model IEnumerable<IceCreamYouScreamCorp.Domain.Product>
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
<p>
@Html.ActionLink("Create New", "Create")
</p>
<table>
<tr>
<th>
Name
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Name)
</td>
<td>
@Html.ActionLink("Edit", "Update", new { id=item.Id })
</td>
</tr>
}
</table>
@model IceCreamYouScreamCorp.Domain.Product
@{
ViewBag.Title = "Update";
}
<h2>Update</h2>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
@using (Html.BeginForm()) {
@Html.ValidationSummary(true)
<fieldset>
<legend>Product</legend>
<div class="editor-label">
@Html.LabelFor(model => model.Name)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Name)
@Html.ValidationMessageFor(model => model.Name)
</div>
@Html.HiddenFor(model => model.Id)
<p>
<input type="submit" value="Save" />
</p>
</fieldset>
@Html.AntiForgeryToken()
}
<div>
@Html.ActionLink("Back to List", "Index")
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment