I have the following Model:
public class ContractPlain
{
public int Id { get; set; }
public Guid ContractGuid { get; set; }
public int SenderId {
See the view below. You simply foreach over your collection and display the Contracts.
Controller:
public class ContactsController : Controller
{
public ActionResult Index()
{
var model = // your model
return View(model);
}
}
View:
<table class="grid">
<tr>
<th>Foo</th>
</tr>
<% foreach (var item in Model) { %>
<tr>
<td class="left"><%: item.Foo %></td>
</tr>
<% } %>
</table>
Razor:
@model IEnumerable<ContractPlain>
<table class="grid">
<tr>
<th>Foo</th>
</tr>
@foreach (var item in Model) {
<tr>
<td class="left"><@item.Foo></td>
</tr>
@}
</table>
If your action returns a List
of contracts you can do the following in the view:
@model IEnumerable<ContractPlain>
@foreach(ContractPlain contract in Model)
{
<ul>
<li>@contract.ContractGuid</li>
<li>@contract.SenderId</li>
<li>@contract.ContractStatus</li>
<li>@contract.CreditEnd</li>
</ul>
}