1 pièce(s) jointe(s)
Perte de données entity framework avec ma vue sur sql server
Bonjour,
Depuis hier quand je veux afficher les données de ma vue (cf ci dessous)
Pièce jointe 599906
Je n'arrive pas a avoir toute les données sur ma vue, je ne sais pas pourquoi exactement mais il en manque quelques une et en sur ma vue en base alles y sont bien. Est ce normal qu'il y est ce genre de problème avec les vues sql server avec entity framework?
Voici mon Controller qui est très simple, c'est juste la liste de ma vue sql server (ADR) que j'envoie a ma vue htmlcs (RapportADR) :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| namespace ProduitChimique.WebUi.Controllers
{
public class RapportController : Controller
{
// GET: Rapport
public ActionResult RapportADR()
{
List<adr> adrList = new List<adr>();
using (var context = new ProduitEntities())
{
adrList = context.adr.ToList();
}
return View(adrList);
}
}
} |
Voici ma vue CSHTML:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
| @model IEnumerable<ProduitChimique.Data.adr>
@{
ViewBag.Title = "RapportADR";
}
<h1>ADR</h1>
<table class="table table-responsive table-bordered">
<thead>
<tr>
<th>
@Html.ActionLink("Secteur", "RapportADR", new { trie = "secteur" })
</th>
<th>
Atelier
</th>
<th>
Nom
</th>
<th>
Utilisation
</th>
<th>
Pictogramme
</th>
<th>
Mention danger
</th>
<th>
@Html.ActionLink("N°onu", "RapportADR", new { trie = "onu" })
</th>
<th>
Code danger adr
</th>
<th>
Groupe emballage
</th>
<th>
Quantité limitée
</th>
<th>
pH
</th>
<th>
Point éclair
</th>
<th>
Densite
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.secteur)
</td>
<td>
@Html.DisplayFor(modelItem => item.atelier)
</td>
<td>
@Html.DisplayFor(modelItem => item.nom)
</td>
<td>
@Html.DisplayFor(modelItem => item.utilisation)
</td>
<td>
@if (item.sgh01)
{
<img src="@Url.Content("~/Images/sgh01.jpg")" alt="sgh01" style="width: 40px; margin-left:5px;" />
}
@if (item.sgh02)
{
<img src="@Url.Content("~/Images/sgh02.jpg")" alt="sgh02" style="width: 40px; margin-left:5px;" />
}
@if (item.sgh03)
{
<img src="@Url.Content("~/Images/sgh03.jpg")" alt="sgh03" style="width: 40px; margin-left:5px;" />
}
@if (item.sgh04)
{
<img src="@Url.Content("~/Images/sgh04.jpg")" alt="sgh04" style="width: 40px; margin-left:5px;" />
}
@if (item.sgh05)
{
<img src="@Url.Content("~/Images/sgh05.jpg")" alt="sgh05" style="width: 40px; margin-left:5px;" />
}
@if (item.sgh06)
{
<img src="@Url.Content("~/Images/sgh06.jpg")" alt="sgh06" style="width: 40px; margin-left:5px;" />
}
@if (item.sgh07)
{
<img src="@Url.Content("~/Images/sgh07.jpg")" alt="sgh07" style="width: 40px; margin-left:5px;" />
}
@if (item.sgh08)
{
<img src="@Url.Content("~/Images/sgh08.jpg")" alt="sgh08" style="width: 40px; margin-left:5px;" />
}
@if (item.sgh09)
{
<img src="@Url.Content("~/Images/sgh09.jpg")" alt="sgh09" style="width: 40px; margin-left:5px;" />
}
</td>
<td>
@Html.DisplayFor(modelItem => item.mention_danger)
</td>
<td>
@Html.DisplayFor(modelItem => item.num_onu)
</td>
<td>
@Html.DisplayFor(modelItem => item.code_danger_adr)
</td>
<td>
@Html.DisplayFor(modelItem => item.groupe_emballage)
</td>
<td>
@Html.DisplayFor(modelItem => item.quantite_limitee)
</td>
<td>
@Html.DisplayFor(modelItem => item.ph)
</td>
<td>
@Html.DisplayFor(modelItem => item.point_eclair)
</td>
<td>
@Html.DisplayFor(modelItem => item.densite)
</td>
</tr>
}
</tbody>
</table> |