summaryrefslogtreecommitdiff
path: root/Models
diff options
context:
space:
mode:
authorSergey Chebotar <s.chebotar@gmail.com>2023-03-06 07:41:35 +0300
committerSergey Chebotar <s.chebotar@gmail.com>2023-03-06 07:41:35 +0300
commit0c4d13caed53b2702eef41461d0c8a4b25df48f6 (patch)
tree6fb6d2d54cedce1c204fb30b75f4d470fbf7ee83 /Models
parentcdd58a8f518d037658518c233e74beea22d03906 (diff)
Base authorization/authentification
Diffstat (limited to 'Models')
-rw-r--r--Models/IdentityContext.cs13
-rw-r--r--Models/LoginModel.cs13
-rw-r--r--Models/SeedData.cs64
3 files changed, 26 insertions, 64 deletions
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<IdentityUser>
+{
+ public IdentityContext(DbContextOptions<IdentityContext> 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<Figure>
-// {
-// 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<Figure>
-// {
-// 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