@model Francesco.Recipes.World.Models.InstructionViewModel

Instructions

@{ var groupedInstructions = Model.Instructions.OrderBy(i => i.Number).ToList(); var rows = (int)Math.Ceiling(groupedInstructions.Count / 3.0); for (int row = 0; row < rows; row++) {
@for (int col = 0; col < 3 && (row * 3 + col < groupedInstructions.Count); col++) { var instruction = groupedInstructions[row * 3 + col];
@if (instruction.MediaFiles != null && instruction.MediaFiles.Any()) { var mediaFile = instruction.MediaFiles.First(); @if (mediaFile.Data != null && mediaFile.Data.Length > 0) { Step @instruction.Number } } else {
} @instruction.Number

@instruction.Description

}
} }