From 3bade8859bcd938b85c39ab16eaa0dcf8e01535f Mon Sep 17 00:00:00 2001 From: Sergey Chebotar Date: Sat, 3 Jun 2023 07:41:46 +0300 Subject: Mass refactoring --- Pages/Shared/_Navigation.cshtml | 2 +- Pages/Shared/_Products.cshtml | 44 +++++++++++++++++++++++++++++++++++++++++ Pages/Shared/_Projects.cshtml | 39 ------------------------------------ 3 files changed, 45 insertions(+), 40 deletions(-) create mode 100644 Pages/Shared/_Products.cshtml delete mode 100644 Pages/Shared/_Projects.cshtml (limited to 'Pages/Shared') diff --git a/Pages/Shared/_Navigation.cshtml b/Pages/Shared/_Navigation.cshtml index 7c29a6b..736fd61 100644 --- a/Pages/Shared/_Navigation.cshtml +++ b/Pages/Shared/_Navigation.cshtml @@ -10,7 +10,7 @@ diff --git a/Pages/Shared/_Products.cshtml b/Pages/Shared/_Products.cshtml new file mode 100644 index 0000000..a82ac1c --- /dev/null +++ b/Pages/Shared/_Products.cshtml @@ -0,0 +1,44 @@ +@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) +
+
+
+
+ } +
+
+
\ No newline at end of file diff --git a/Pages/Shared/_Projects.cshtml b/Pages/Shared/_Projects.cshtml deleted file mode 100644 index 4b9a62e..0000000 --- a/Pages/Shared/_Projects.cshtml +++ /dev/null @@ -1,39 +0,0 @@ -@using System.Globalization -@using Microsoft.EntityFrameworkCore -@using MyDarling.Models -@inject DataContext context - -@{ - var bundles = context.UnderwearBundles - .Include(b => b.Figures) - .Where(b => b.Price != 0 && b.Figures.Count > 0) - .OrderByDescending(b => b.Id); -} - -
-
-
- @foreach (var bundle in bundles) - { -
-
- @bundle.Name - @for (int i = 1; i < @bundle.Figures.Count(); i++) - { - - } -
-
-
@bundle.Name
- @String.Format(new CultureInfo("ru-RU"), "{0:C0}", @bundle.Price) -
-
-
-
- } -
-
-
\ No newline at end of file -- cgit v1.2.3