From 0107d5b518f586bc2172b4e89f0cab7619e76670 Mon Sep 17 00:00:00 2001 From: Sergey Chebotar Date: Tue, 21 Feb 2023 07:52:11 +0300 Subject: [PATCH] Add decription to figure model --- ...t.Designer.cs => 20230221044417_Init.Designer.cs} | 6 +++++- ...20230201062503_Init.cs => 20230221044417_Init.cs} | 1 + Migrations/DataContextModelSnapshot.cs | 4 ++++ Models/Figure.cs | 11 ++++++----- Models/SeedData.cs | 12 ++++++------ Program.cs | 10 +++++----- Views/Home/_Projects.cshtml | 5 +++-- 7 files changed, 30 insertions(+), 19 deletions(-) rename Migrations/{20230201062503_Init.Designer.cs => 20230221044417_Init.Designer.cs} (93%) rename Migrations/{20230201062503_Init.cs => 20230221044417_Init.cs} (96%) diff --git a/Migrations/20230201062503_Init.Designer.cs b/Migrations/20230221044417_Init.Designer.cs similarity index 93% rename from Migrations/20230201062503_Init.Designer.cs rename to 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 { /// @@ -26,6 +26,10 @@ namespace MyDarling.Migrations .ValueGeneratedOnAdd() .HasColumnType("INTEGER"); + b.Property("Description") + .IsRequired() + .HasColumnType("TEXT"); + b.Property("FilePath") .IsRequired() .HasColumnType("TEXT"); diff --git a/Migrations/20230201062503_Init.cs b/Migrations/20230221044417_Init.cs similarity index 96% rename from Migrations/20230201062503_Init.cs rename to 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(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), + Description = table.Column(type: "TEXT", nullable: false), FilePath = table.Column(type: "TEXT", nullable: false), UnderwearBundleId = table.Column(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("Description") + .IsRequired() + .HasColumnType("TEXT"); + b.Property("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 }; diff --git a/Program.cs b/Program.cs index 5309b9f..4079b2b 100644 --- a/Program.cs +++ b/Program.cs @@ -5,10 +5,10 @@ var builder = WebApplication.CreateBuilder(args); builder.Services.AddDbContext(opts => { - opts.UseSqlite(builder.Configuration["ConnectionStrings:MyDarlingDb"]); - opts.EnableSensitiveDataLogging(true); + opts.UseSqlite(builder.Configuration["ConnectionStrings:MyDarlingDb"]); + opts.EnableSensitiveDataLogging(true); }); -// builder.Services.AddSingleton(); + builder.Services.AddControllersWithViews(); var app = builder.Build(); @@ -17,7 +17,7 @@ app.UseStaticFiles(); app.MapControllers(); app.MapDefaultControllerRoute(); -// var context = app.Services.CreateScope().ServiceProvider.GetRequiredService(); -// SeedData.SeedDatabase(context); +var context = app.Services.CreateScope().ServiceProvider.GetRequiredService(); +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 @@
@bundle.Name @for (int i = 1; i < @bundle.Figures.Count(); i++) { - + }