I am new to MVC and I have a question regarding my view.
I have a strongly typed view:
@model CellularAutomata.Models.D1CellularAutomata
@{
ViewBag.Title = "View";
}
<h2>View</h2>
<table>
@foreach (CellularAutomata.Models.Grid grid in Model.GridHistory){
<tr>
@foreach (CellularAutomata.Models.Cell cell in grid.Cells[0]){
if (cell.State == CellularAutomata.Models.State.On){
<td>X</td>
}
if (cell.State == CellularAutomata.Models.State.Off){
<td>O</td>
}
}
</tr>
}
</table>
Does this violate the MVC rules for referencing parts of the model in my opinion, such as
(CellularAutomata.Models.Cell cell in grid.Cells[0])
or
(cell.State == CellularAutomata.Models.State.On)
If this is not true, what is the best way to fix it?
source
share