From 0c9d39d506d2a17cfd4303710ae6f4ae7d6c66aa Mon Sep 17 00:00:00 2001 From: "ani_konarcheva@abv.bg" Date: Sat, 26 Mar 2022 11:39:34 +0200 Subject: [PATCH] commit --- RentACar/Data/Entities/User.cs | 10 +++++----- .../RentACarDbCreateIfNotExistsInitializer.cs | 12 ++++++++++++ .../RentACarDbDropCreateIfModelChanges.cs | 12 ++++++++++++ RentACar/Data/Initializers/Seeder.cs | 12 ++++++++++++ RentACar/Data/RentACarDbContext.cs | 14 +++++++++++++- 5 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 RentACar/Data/Initializers/RentACarDbCreateIfNotExistsInitializer.cs create mode 100644 RentACar/Data/Initializers/RentACarDbDropCreateIfModelChanges.cs create mode 100644 RentACar/Data/Initializers/Seeder.cs diff --git a/RentACar/Data/Entities/User.cs b/RentACar/Data/Entities/User.cs index a4a2d16..5cbab1b 100644 --- a/RentACar/Data/Entities/User.cs +++ b/RentACar/Data/Entities/User.cs @@ -3,10 +3,11 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Microsoft.AspNetCore.Identity; namespace Data.Entities { - public class User + public class User : IdentityUser { public enum RoleEnum { @@ -14,8 +15,7 @@ namespace Data.Entities Manager } - - public int Id { get; set; } + public override string Id { get; set; } public string Username { get; set; } @@ -27,9 +27,9 @@ namespace Data.Entities public int PersonalNumber { get; set; } - public int PhoneNumber { get; set; } + public override string PhoneNumber { get; set; } - public string Email { get; set; } + public override string Email { get; set; } public RoleEnum Role { get; set; } } diff --git a/RentACar/Data/Initializers/RentACarDbCreateIfNotExistsInitializer.cs b/RentACar/Data/Initializers/RentACarDbCreateIfNotExistsInitializer.cs new file mode 100644 index 0000000..9728276 --- /dev/null +++ b/RentACar/Data/Initializers/RentACarDbCreateIfNotExistsInitializer.cs @@ -0,0 +1,12 @@ +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 new file mode 100644 index 0000000..731cc31 --- /dev/null +++ b/RentACar/Data/Initializers/RentACarDbDropCreateIfModelChanges.cs @@ -0,0 +1,12 @@ +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 new file mode 100644 index 0000000..635a73d --- /dev/null +++ b/RentACar/Data/Initializers/Seeder.cs @@ -0,0 +1,12 @@ +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 0d77c52..3aa0cdb 100644 --- a/RentACar/Data/RentACarDbContext.cs +++ b/RentACar/Data/RentACarDbContext.cs @@ -1,15 +1,27 @@ using System; using Data.Entities; +using Microsoft.AspNetCore.Identity; +using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; namespace Data { - public class RentACarDbContext : DbContext + public class RentACarDbContext : IdentityDbContext { public virtual DbSet Users { get; set; } public virtual DbSet Cars { get; set; } public virtual DbSet Rents { get; set; } + public RentACarDbContext() + { + + } + + public RentACarDbContext(DbContextOptions dbContextOptions) : base(dbContextOptions) + { + + } + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { if (!optionsBuilder.IsConfigured)