diff options
author | Sergey Chebotar <s.chebotar@gmail.com> | 2023-02-21 07:52:11 +0300 |
---|---|---|
committer | Sergey Chebotar <s.chebotar@gmail.com> | 2023-02-21 07:52:11 +0300 |
commit | 0107d5b518f586bc2172b4e89f0cab7619e76670 (patch) | |
tree | 60a93c8b8c9ebb2bef218280a2ee8d6f4e6a7019 | |
parent | 3c83f9f4b01b5965e04739e5f8accf3235f8f699 (diff) |
Add decription to figure model
-rw-r--r-- | Migrations/20230221044417_Init.Designer.cs (renamed from Migrations/20230201062503_Init.Designer.cs) | 6 | ||||
-rw-r--r-- | Migrations/20230221044417_Init.cs (renamed from Migrations/20230201062503_Init.cs) | 1 | ||||
-rw-r--r-- | Migrations/DataContextModelSnapshot.cs | 4 | ||||
-rw-r--r-- | Models/Figure.cs | 11 | ||||
-rw-r--r-- | Models/SeedData.cs | 12 | ||||
-rw-r--r-- | Program.cs | 10 | ||||
-rw-r--r-- | Views/Home/_Projects.cshtml | 5 |
7 files changed, 30 insertions, 19 deletions
diff --git a/Migrations/20230201062503_Init.Designer.cs b/Migrations/20230221044417_Init.Designer.cs index 18bb01e..658e6b7 100644 --- a/Migrations/20230201062503_Init.Designer.cs +++ b/Migrations/20230221044417_Init.Designer.cs @@ -11,7 +11,7 @@ using MyDarling.Models; namespace MyDarling.Migrations { [DbContext(typeof(DataContext))] - [Migration("20230201062503_Init")] + [Migration("20230221044417_Init")] partial class Init { /// <inheritdoc /> @@ -26,6 +26,10 @@ namespace MyDarling.Migrations .ValueGeneratedOnAdd() .HasColumnType("INTEGER"); + b.Property<string>("Description") + .IsRequired() + .HasColumnType("TEXT"); + b.Property<string>("FilePath") .IsRequired() .HasColumnType("TEXT"); diff --git a/Migrations/20230201062503_Init.cs b/Migrations/20230221044417_Init.cs index fe709a8..788d447 100644 --- a/Migrations/20230201062503_Init.cs +++ b/Migrations/20230221044417_Init.cs @@ -31,6 +31,7 @@ namespace MyDarling.Migrations { Id = table.Column<int>(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), + Description = table.Column<string>(type: "TEXT", nullable: false), FilePath = table.Column<string>(type: "TEXT", nullable: false), UnderwearBundleId = table.Column<int>(type: "INTEGER", nullable: true) }, diff --git a/Migrations/DataContextModelSnapshot.cs b/Migrations/DataContextModelSnapshot.cs index bff1af3..b2177d7 100644 --- a/Migrations/DataContextModelSnapshot.cs +++ b/Migrations/DataContextModelSnapshot.cs @@ -23,6 +23,10 @@ namespace MyDarling.Migrations .ValueGeneratedOnAdd() .HasColumnType("INTEGER"); + b.Property<string>("Description") + .IsRequired() + .HasColumnType("TEXT"); + b.Property<string>("FilePath") .IsRequired() .HasColumnType("TEXT"); diff --git a/Models/Figure.cs b/Models/Figure.cs index 7ac5b5f..f63d842 100644 --- a/Models/Figure.cs +++ b/Models/Figure.cs @@ -1,8 +1,9 @@ namespace MyDarling.Models { - public class Figure - { - public int Id { get; set; } - public string FilePath { get; set; } = string.Empty; - } + public class Figure + { + public int Id { get; set; } + public string Description { get; set; } = string.Empty; + public string FilePath { get; set; } = string.Empty; + } }
\ No newline at end of file diff --git a/Models/SeedData.cs b/Models/SeedData.cs index c7b8692..da8263f 100644 --- a/Models/SeedData.cs +++ b/Models/SeedData.cs @@ -12,10 +12,12 @@ namespace MyDarling.Models { new Figure() { + Description = @"Комплект из бежевого эластичного кружева с голубой отделкой.", FilePath = "/content/0/img/IMG_4896.JPG" }, new Figure() { + Description = @"В комплект входит бра, 2 трусиков (на высокой посадке и стандартной на регуляции) и чокер. Низ можно сделать на выбор стринги/бразильянки.", FilePath = "/content/0/img/IMG_4902.JPG" } }; @@ -24,10 +26,12 @@ namespace MyDarling.Models { new Figure() { + Description = @"Базовый сет из мягкой эластичной сетки.", FilePath = "/content/1/img/IMG_4897.JPG" }, new Figure() { + Description = @"В комплект входит лиф на косточках и 2 трусиков – бразильянки на высокой посадке и стринги на стандартной посадке с регуляцией. Доступен в цветах: желтый, черный, бежевый молочный.", FilePath = "/content/1/img/IMG_4898.JPG" } }; @@ -40,9 +44,7 @@ namespace MyDarling.Models { Name = "Alice", Figures = aliceFigures, - Description = @"Комплект из бежевого эластичного кружева с голубой отделкой. - В комплект входит бра, 2 трусиков (на высокой посадке и стандартной на регуляции) и чокер. - Низ можно сделать на выбор стринги/бразильянки.", + Description = @"Комплект из бежевого эластичного кружева с голубой отделкой.", Price = 3000 }; @@ -50,9 +52,7 @@ namespace MyDarling.Models { Name = "Nikki", Figures = nikkiFigures, - Description = @"Базовый сет из мягкой эластичной сетки. - В комплект входит лиф на косточках и 2 трусиков – бразильянки на высокой посадке и стринги на стандартной посадке с регуляцией. - Доступен в цветах: желтый, черный, бежевый молочный.", + Description = @"Базовый сет из мягкой эластичной сетки.", Price = 3800 }; @@ -5,10 +5,10 @@ var builder = WebApplication.CreateBuilder(args); builder.Services.AddDbContext<DataContext>(opts => { - opts.UseSqlite(builder.Configuration["ConnectionStrings:MyDarlingDb"]); - opts.EnableSensitiveDataLogging(true); + opts.UseSqlite(builder.Configuration["ConnectionStrings:MyDarlingDb"]); + opts.EnableSensitiveDataLogging(true); }); -// builder.Services.AddSingleton<IRepository, MyDarlingRepository>(); + builder.Services.AddControllersWithViews(); var app = builder.Build(); @@ -17,7 +17,7 @@ app.UseStaticFiles(); app.MapControllers(); app.MapDefaultControllerRoute(); -// var context = app.Services.CreateScope().ServiceProvider.GetRequiredService<DataContext>(); -// SeedData.SeedDatabase(context); +var context = app.Services.CreateScope().ServiceProvider.GetRequiredService<DataContext>(); +SeedData.SeedDatabase(context); app.Run();
\ No newline at end of file diff --git a/Views/Home/_Projects.cshtml b/Views/Home/_Projects.cshtml index 0603c06..2cb439d 100644 --- a/Views/Home/_Projects.cshtml +++ b/Views/Home/_Projects.cshtml @@ -9,11 +9,12 @@ <div class="col mb-5"> <div class="card h-100"> <a data-src="@bundle.Figures.FirstOrDefault()?.FilePath" data-fancybox="@bundle.Id" - data-caption="@bundle.Description"><img class="card-img-top" + data-caption="@bundle.Figures.FirstOrDefault()?.Description"><img class="card-img-top" src="@bundle.Figures.FirstOrDefault()?.FilePath" alt="@bundle.Name" /></a> @for (int i = 1; i < @bundle.Figures.Count(); i++) { - <a data-src="@bundle.Figures[i].FilePath" data-fancybox="@bundle.Id"></a> + <a data-src="@bundle.Figures[i].FilePath" data-fancybox="@bundle.Id" + data-caption="@bundle.Figures[i].Description"></a> } <div class="card-body p-4"> <div class="text-center"> |