I want to show the amount of different types of vitamins present in specific types of food samples, using ASP.NET MVC3. How can I display this in my View (Index.cshtml) ?
an example:
这些是我的法典:
<table>
<tr>
<th></th>
@foreach (var m in Model)
{
foreach (var v in m.Vitamins)
{
<th>@v.Name</th>
}
}
</tr>
@foreach (var m in Model)
{
foreach (var f in m.Foods)
{
<tr>
<td>@f.Type</td>
</tr>
}
}
</table>
@*The amount of Vitamins in each food:
var a in m.AmountOfVitamins
@a.Amount
*@