commit
This commit is contained in:
@@ -3,10 +3,11 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Identity;
|
||||||
|
|
||||||
namespace Data.Entities
|
namespace Data.Entities
|
||||||
{
|
{
|
||||||
public class User
|
public class User : IdentityUser<string>
|
||||||
{
|
{
|
||||||
public enum RoleEnum
|
public enum RoleEnum
|
||||||
{
|
{
|
||||||
@@ -14,8 +15,7 @@ namespace Data.Entities
|
|||||||
Manager
|
Manager
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string Id { get; set; }
|
||||||
public int Id { get; set; }
|
|
||||||
|
|
||||||
public string Username { get; set; }
|
public string Username { get; set; }
|
||||||
|
|
||||||
@@ -27,9 +27,9 @@ namespace Data.Entities
|
|||||||
|
|
||||||
public int PersonalNumber { get; set; }
|
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; }
|
public RoleEnum Role { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
12
RentACar/Data/Initializers/Seeder.cs
Normal file
12
RentACar/Data/Initializers/Seeder.cs
Normal file
@@ -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
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,15 +1,27 @@
|
|||||||
using System;
|
using System;
|
||||||
using Data.Entities;
|
using Data.Entities;
|
||||||
|
using Microsoft.AspNetCore.Identity;
|
||||||
|
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace Data
|
namespace Data
|
||||||
{
|
{
|
||||||
public class RentACarDbContext : DbContext
|
public class RentACarDbContext : IdentityDbContext<User, IdentityRole, string>
|
||||||
{
|
{
|
||||||
public virtual DbSet<User> Users { get; set; }
|
public virtual DbSet<User> Users { get; set; }
|
||||||
public virtual DbSet<Car> Cars { get; set; }
|
public virtual DbSet<Car> Cars { get; set; }
|
||||||
public virtual DbSet<Rents> Rents { get; set; }
|
public virtual DbSet<Rents> Rents { get; set; }
|
||||||
|
|
||||||
|
public RentACarDbContext()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public RentACarDbContext(DbContextOptions<RentACarDbContext> dbContextOptions) : base(dbContextOptions)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
{
|
{
|
||||||
if (!optionsBuilder.IsConfigured)
|
if (!optionsBuilder.IsConfigured)
|
||||||
|
|||||||
Reference in New Issue
Block a user