-
Notifications
You must be signed in to change notification settings - Fork 0
Sample: MVC Views Test Index
Mendz edited this page Oct 8, 2017
·
2 revisions
Create a file named Index.cshtml and enter the following:
@model IEnumerable<TestModels.Test>
@{
ViewData["Title"] = "Index";
}
<h2>Index</h2>
<p>
<a asp-action="Create">Create New</a>
</p>
<table class="table">
<thead>
<tr>
<th>
@Html.DisplayNameFor(model => model.TestID)
</th>
<th>
@Html.DisplayNameFor(model => model.Code)
</th>
<th>
@Html.DisplayNameFor(model => model.Name)
</th>
<th>
@Html.DisplayNameFor(model => model.Description)
</th>
<th>
@Html.DisplayNameFor(model => model.CreatedBy)
</th>
<th>
@Html.DisplayNameFor(model => model.CreatedDate)
</th>
<th>
@Html.DisplayNameFor(model => model.ModifiedBy)
</th>
<th>
@Html.DisplayNameFor(model => model.ModifiedDate)
</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.TestID)
</td>
<td>
@Html.DisplayFor(modelItem => item.Code)
</td>
<td>
@Html.DisplayFor(modelItem => item.Name)
</td>
<td>
@Html.DisplayFor(modelItem => item.Description)
</td>
<td>
@Html.DisplayFor(modelItem => item.CreatedBy)
</td>
<td>
@Html.DisplayFor(modelItem => item.CreatedDate)
</td>
<td>
@Html.DisplayFor(modelItem => item.ModifiedBy)
</td>
<td>
@Html.DisplayFor(modelItem => item.ModifiedDate)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id = item.TestID }) |
@Html.ActionLink("Details", "Details", new { id = item.TestID }) |
@Html.ActionLink("Delete", "Delete", new { id = item.TestID })
</td>
</tr>
}
</tbody>
</table>