49 lines
2.5 KiB
Plaintext
49 lines
2.5 KiB
Plaintext
@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);
|
|
}
|
|
|
|
<section class="projects-section bg-light" id="products">
|
|
<div class="container px-3 px-lg-4 mt-4">
|
|
<div class="row gx-4 gx-lg-5 row-cols-2 row-cols-md-3 row-cols-xl-4 justify-content-center">
|
|
@foreach (var product in products)
|
|
{
|
|
<div class="col mb-5">
|
|
<div class="card h-100" itemscope itemtype="http://schema.org/Product">
|
|
<meta itemprop="name" content="@product.Name"/>
|
|
<meta itemprop="description" content="@product.Description"/>
|
|
@{
|
|
var figure = product.Figures.First();
|
|
var filePath = $"/Content/{product.Id}/{figure.Id}.jpg";
|
|
var thumbnailPath = $"/Content/{product.Id}/{figure.Id}_thumb.jpg";
|
|
}
|
|
<a data-src="@filePath" data-fancybox="@product.Id"
|
|
data-caption="@figure.Description"><img class="card-img-top"
|
|
src="@thumbnailPath" alt="@product.Name" itemprop="image"/></a>
|
|
@for (int i = 1; i < product.Figures.Count(); i++)
|
|
{
|
|
filePath = $"/Content/{product.Id}/{product.Figures[i].Id}.jpg";
|
|
<a data-src="@filePath" data-fancybox="@product.Id"
|
|
data-caption="@product.Figures[i].Description"></a>
|
|
}
|
|
<div class="card-body p-4">
|
|
<div class="text-center" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
|
|
<h5 class="fw-bolder" itemprop="name">@product.Name</h5>
|
|
<span>@String.Format(new CultureInfo("ru-RU"), "{0:C0}", product.Price)</span>
|
|
<meta itemprop="price" content="@product.Price"/>
|
|
<meta itemprop="priceCurrency" content="RUB"/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
}
|
|
</div>
|
|
</div>
|
|
</section> |