When I create a user and he's logged in for the first time I get this error when I try to display(View details) the requests that he created so far(0 request created). Once I rerun the application again with the same user the view works and I get no error. Here's the line that's generates the error:
@foreach (var item in Model)`
Here's the view that generates the error:
@model IEnumerable<Mutuelle.Domain.Entities.Demande>
@{
ViewBag.Title = "DemandesAdherent";
}
@{
Layout = "~/Views/Shared/_LayoutAdherent.cshtml";
}
<h2>DemandesAdherent</h2>
<p>
@Html.ActionLink("Creér nouvelle", "AddDemande")
</p>
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.Date)
</th>
<th>
@Html.DisplayNameFor(model => model.nomBeneficiaire)
</th>
<th>
@Html.DisplayNameFor(model => model.Nomrubrique)
</th>
<th>
@Html.DisplayNameFor(model => model.etat)
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Date)
</td>
<td>
@Html.DisplayFor(modelItem => item.nomBeneficiaire)
</td>
<td>
@Html.DisplayFor(modelItem => item.Nomrubrique)
</td>
<td>
@Html.DisplayFor(modelItem => item.etat)
</td>
<td>
@Html.ActionLink("Details", "DetailsDemande", new { id=item.DemandeId }) @*|
@Html.ActionLink("Delete", "DeleteDemande", new { id=item.DemandeId })*@
</td>
</tr>
}
</table>