From 4cd4e22ea770cc1f13bbb9bcc06f21c89aa31584 Mon Sep 17 00:00:00 2001 From: "ani_konarcheva@abv.bg" Date: Sat, 26 Mar 2022 14:39:51 +0200 Subject: [PATCH] commit2 --- .../RentACarDbCreateIfNotExistsInitializer.cs | 12 -------- .../RentACarDbDropCreateIfModelChanges.cs | 12 -------- RentACar/Data/Initializers/Seeder.cs | 12 -------- RentACar/Data/RentACarDbContext.cs | 30 +++++++++++++++++++ 4 files changed, 30 insertions(+), 36 deletions(-) delete mode 100644 RentACar/Data/Initializers/RentACarDbCreateIfNotExistsInitializer.cs delete mode 100644 RentACar/Data/Initializers/RentACarDbDropCreateIfModelChanges.cs delete mode 100644 RentACar/Data/Initializers/Seeder.cs diff --git a/RentACar/Data/Initializers/RentACarDbCreateIfNotExistsInitializer.cs b/RentACar/Data/Initializers/RentACarDbCreateIfNotExistsInitializer.cs deleted file mode 100644 index 9728276..0000000 --- a/RentACar/Data/Initializers/RentACarDbCreateIfNotExistsInitializer.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Data.Initializers -{ - class RentACarDbCreateIfNotExistsInitializer - { - } -} diff --git a/RentACar/Data/Initializers/RentACarDbDropCreateIfModelChanges.cs b/RentACar/Data/Initializers/RentACarDbDropCreateIfModelChanges.cs deleted file mode 100644 index 731cc31..0000000 --- a/RentACar/Data/Initializers/RentACarDbDropCreateIfModelChanges.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Data.Initializers -{ - class RentACarDbDropCreateIfModelChanges - { - } -} diff --git a/RentACar/Data/Initializers/Seeder.cs b/RentACar/Data/Initializers/Seeder.cs deleted file mode 100644 index 635a73d..0000000 --- a/RentACar/Data/Initializers/Seeder.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Data.Initializers -{ - class Seeder - { - } -} diff --git a/RentACar/Data/RentACarDbContext.cs b/RentACar/Data/RentACarDbContext.cs index 3aa0cdb..57caa0a 100644 --- a/RentACar/Data/RentACarDbContext.cs +++ b/RentACar/Data/RentACarDbContext.cs @@ -30,6 +30,36 @@ namespace Data } } + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.Entity().HasData( + new User + { + Username = "user", + Password = "user", + FirstName = "User", + LastName = "User", + PersonalNumber = 0987654321, + PhoneNumber = "0882750588", + Email = "user@gmail.org", + Role = User.RoleEnum.User + } + ); + modelBuilder.Entity().HasData( + new User + { + Username = "manager", + Password = "manager", + FirstName = "Manager", + LastName = "Manager", + PersonalNumber = 0987654321, + PhoneNumber = "0882750588", + Email = "manager@gmail.org", + Role = User.RoleEnum.Manager + } + ); + } + } }