in this code i am not understood of @foreach (var item in Model)
what is Model Object.
can we use model.Student
@model IEnumerable<MVC_BasicTutorials.Models.Student>
@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>Index</h2>
<p>@Html.ActionLink("Create New", "Create")</p>
<table class="table">
<tr>
<th>@Html.DisplayNameFor(model => model.StudentName)</th>
<th>@Html.DisplayNameFor(model => model.Age)</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>@Html.DisplayFor(modelItem => item.StudentName)</td>
<td>@Html.DisplayFor(modelItem => item.Age)</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id=item.StudentId }) |
@Html.ActionLink("Details", "Details", new { id=item.StudentId }) |
@Html.ActionLink("Delete", "Delete", new { id = item.StudentId })
</td>
</tr>
}
</table>