@using System.Globalization @using Microsoft.EntityFrameworkCore @using MyDarling.Models @inject DataContext context @{ var products = context.Products .Include(b => b.Figures) .Where(b => b.Price != 0 && b.Figures.Count > 0) .OrderByDescending(b => b.Id); }
@foreach (var product in products) {
@{ var figure = product.Figures.First(); var filePath = $"/Content/{product.Id}/{figure.Id}.jpg"; } @product.Name @for (int i = 1; i < product.Figures.Count(); i++) { filePath = $"/Content/{product.Id}/{product.Figures[i].Id}.jpg"; }
@product.Name
@String.Format(new CultureInfo("ru-RU"), "{0:C0}", product.Price)
}