Exemplo n.º 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();
 }
Exemplo n.º 2
0
 static void SeedNursingStaffs(RCCSUsersContext context)
 {
     context.NursingStaffs.Add(
         new EfNursingStaff()
     {
         EfUserId    = 3,
         PersonaleId = "NursingStaff",
         FirstName   = "NursingStaffFirstName",
         LastName    = "NursingStaffLastName",
     });
     context.SaveChanges();
 }
Exemplo n.º 3
0
 static void SeedCoordinators(RCCSUsersContext context)
 {
     context.Coordinators.Add(
         new EfCoordinator()
     {
         EfUserId    = 2,
         PersonaleId = "Coordinator",
         FirstName   = "CoordinatorFirstName",
         LastName    = "CoordinatorLastName",
     });
     context.SaveChanges();
 }
Exemplo n.º 4
0
 static void SeedAdmins(RCCSUsersContext context)
 {
     context.Admins.Add(
         new EfAdmin
     {
         EfUserId    = 1,
         PersonaleId = "Admin",
         FirstName   = "AdminFirstName",
         LastName    = "AdminLastName",
     });
     context.SaveChanges();
 }
Exemplo n.º 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);
     }
 }