Пример #1
0
 static void SeedAccounts(RCCSUsersContext context)
 {
     context.Users.AddRange(
         // Seed admin
         new EfUser
     {
         PersonaleId = "Admin",
         PwHash      = HashPassword("Admin", BcryptWorkfactor),
         Role        = Role.Admin
     },
         // Seed Coordinator
         new EfUser
     {
         PersonaleId = "Coordinator",
         PwHash      = HashPassword("Coordinator", BcryptWorkfactor),
         Role        = Role.Coordinator
     },
         // Seed NursingStaff
         new EfUser
     {
         PersonaleId = "NursingStaff",
         PwHash      = HashPassword("NursingStaff", BcryptWorkfactor),
         Role        = Role.NursingStaff
     }
         // TO DO: Seed other users
         );
     context.SaveChanges();
 }
Пример #2
0
 static void SeedNursingStaffs(RCCSUsersContext context)
 {
     context.NursingStaffs.Add(
         new EfNursingStaff()
     {
         EfUserId    = 3,
         PersonaleId = "NursingStaff",
         FirstName   = "NursingStaffFirstName",
         LastName    = "NursingStaffLastName",
     });
     context.SaveChanges();
 }
Пример #3
0
 static void SeedCoordinators(RCCSUsersContext context)
 {
     context.Coordinators.Add(
         new EfCoordinator()
     {
         EfUserId    = 2,
         PersonaleId = "Coordinator",
         FirstName   = "CoordinatorFirstName",
         LastName    = "CoordinatorLastName",
     });
     context.SaveChanges();
 }
Пример #4
0
 static void SeedAdmins(RCCSUsersContext context)
 {
     context.Admins.Add(
         new EfAdmin
     {
         EfUserId    = 1,
         PersonaleId = "Admin",
         FirstName   = "AdminFirstName",
         LastName    = "AdminLastName",
     });
     context.SaveChanges();
 }
Пример #5
0
 public static void SeedUsers(RCCSUsersContext context)
 {
     context.Database.EnsureCreated();
     if (!context.Users.Any())
     {
         SeedAccounts(context);
     }
     if (!context.Admins.Any())
     {
         SeedAdmins(context);
     }
     if (!context.Coordinators.Any())
     {
         SeedCoordinators(context);
     }
 }