From 0c4d13caed53b2702eef41461d0c8a4b25df48f6 Mon Sep 17 00:00:00 2001 From: Sergey Chebotar Date: Mon, 6 Mar 2023 07:41:35 +0300 Subject: Base authorization/authentification --- Models/IdentityContext.cs | 13 ++++++++++ Models/LoginModel.cs | 13 ++++++++++ Models/SeedData.cs | 64 ----------------------------------------------- 3 files changed, 26 insertions(+), 64 deletions(-) create mode 100644 Models/IdentityContext.cs create mode 100644 Models/LoginModel.cs delete mode 100644 Models/SeedData.cs (limited to 'Models') diff --git a/Models/IdentityContext.cs b/Models/IdentityContext.cs new file mode 100644 index 0000000..888bc7a --- /dev/null +++ b/Models/IdentityContext.cs @@ -0,0 +1,13 @@ +using Microsoft.AspNetCore.Identity; +using Microsoft.AspNetCore.Identity.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; + +namespace MyDarling.Models; + +public class IdentityContext : IdentityDbContext +{ + public IdentityContext(DbContextOptions options) : base(options) + { + + } +} \ No newline at end of file diff --git a/Models/LoginModel.cs b/Models/LoginModel.cs new file mode 100644 index 0000000..93485c8 --- /dev/null +++ b/Models/LoginModel.cs @@ -0,0 +1,13 @@ +using System.ComponentModel.DataAnnotations; + +namespace MyDarling.Models; +public class LoginModel +{ + [Required] + public string? Name { get; set; } + + [Required] + public string? Password { get; set; } + + public string ReturnUrl { get; set; } = "/Bundle"; +} \ No newline at end of file diff --git a/Models/SeedData.cs b/Models/SeedData.cs deleted file mode 100644 index 3a15543..0000000 --- a/Models/SeedData.cs +++ /dev/null @@ -1,64 +0,0 @@ -// using Microsoft.EntityFrameworkCore; -// namespace MyDarling.Models -// { -// public static class SeedData -// { -// public static void SeedDatabase(DataContext context) -// { -// context.Database.Migrate(); -// if (context.UnderwearBundles.Count() == 0) -// { -// var aliceFigures = new List
-// { -// new Figure() -// { -// Description = @"Комплект из бежевого эластичного кружева с голубой отделкой.", -// FilePath = "/content/0/img/IMG_4896.JPG" -// }, -// new Figure() -// { -// Description = @"В комплект входит бра, 2 трусиков (на высокой посадке и стандартной на регуляции) и чокер. Низ можно сделать на выбор стринги/бразильянки.", -// FilePath = "/content/0/img/IMG_4902.JPG" -// } -// }; - -// var nikkiFigures = new List
-// { -// new Figure() -// { -// Description = @"Базовый сет из мягкой эластичной сетки.", -// FilePath = "/content/1/img/IMG_4897.JPG" -// }, -// new Figure() -// { -// Description = @"В комплект входит лиф на косточках и 2 трусиков – бразильянки на высокой посадке и стринги на стандартной посадке с регуляцией. Доступен в цветах: желтый, черный, бежевый молочный.", -// FilePath = "/content/1/img/IMG_4898.JPG" -// } -// }; - -// context.Figures.AddRange(aliceFigures); -// context.Figures.AddRange(nikkiFigures); -// context.SaveChanges(); - -// var alice = new UnderwearBundle -// { -// Name = "Alice", -// Figures = aliceFigures, -// Description = @"Комплект из бежевого эластичного кружева с голубой отделкой.", -// Price = 3000 -// }; - -// var nikki = new UnderwearBundle -// { -// Name = "Nikki", -// Figures = nikkiFigures, -// Description = @"Базовый сет из мягкой эластичной сетки.", -// Price = 3800 -// }; - -// context.UnderwearBundles.AddRange(alice, nikki); -// context.SaveChanges(); -// } -// } -// } -// } \ No newline at end of file -- cgit v1.2.3