@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"; var thumbnailPath = $"/Content/{product.Id}/{figure.Id}_thumb.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)
}