select all rows from database into a list/Collection of Model. When you call the view, you have to call it by
View(collectionOfModel);
on view page, declare
@model IEnumerable<model>
</model>
Define header and user foreach using razor...
<div class="datagrid">
<table>
<thead>
<tr>
<th>Mobile No
</th>
<th>Home Phone No
</th>
<th></th>
</tr>
</thead>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.MobileNo)
</td>
<td>
@Html.DisplayFor(modelItem => item.HomePhoneNo)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id = item.Id }) |
@Html.ActionLink("Details", "Details", new { id = item.Id }) |
@Html.ActionLink("Delete", "Delete", new { id = item.Id })
</td>
</tr>
}
</table>
</div>