public static void SeedAdmin(this ModelBuilder modelBuilder, AlsDbContext context)
        {
            PasswordHasher <ApplicationUser> hasher = new PasswordHasher <ApplicationUser>();

            string          adminUser     = "******";
            string          adminPassword = "******";
            ApplicationUser user          = new ApplicationUser {
                UserName     = adminUser, NormalizedUserName = "******",
                PasswordHash = hasher.HashPassword(null, adminPassword), EducatorId = 1
            };
            IdentityRole adminRole = new IdentityRole {
                Id = "1", Name = "Admin", NormalizedName = "ADMIN"
            };
            IdentityRole userRole = new IdentityRole {
                Name = "User", NormalizedName = "USER"
            };

            modelBuilder.Entity <ApplicationUser>().HasData(user);
            modelBuilder.Entity <IdentityRole>().HasData(adminRole, userRole);
            modelBuilder.Entity <IdentityUserRole <string> >().HasData(
                new IdentityUserRole <string> {
                RoleId = adminRole.Id, UserId = user.Id
            }
                );
            modelBuilder.Entity <IdentityRoleClaim <string> >().HasData(
                new IdentityRoleClaim <string> {
                ClaimType = "Håndter Studerende", ClaimValue = "Håndter Studerende", RoleId = "1", Id = 1
            },
                new IdentityRoleClaim <string> {
                ClaimType = "Se Studerende", ClaimValue = "Se Studerende", RoleId = "1", Id = 2
            },
                new IdentityRoleClaim <string> {
                ClaimType = "Slet Studerende", ClaimValue = "Slet Studerende", RoleId = "1", Id = 3
            },
                new IdentityRoleClaim <string> {
                ClaimType = "Håndter F*g", ClaimValue = "Håndter F*g", RoleId = "1", Id = 4
            },
                new IdentityRoleClaim <string> {
                ClaimType = "Se F*g", ClaimValue = "Se F*g", RoleId = "1", Id = 5
            },
                new IdentityRoleClaim <string> {
                ClaimType = "Slet F*g", ClaimValue = "Slet F*g", RoleId = "1", Id = 6
            },
                new IdentityRoleClaim <string> {
                ClaimType = "Giv Fravær", ClaimValue = "Giv Fravær", RoleId = "1", Id = 7
            },
                new IdentityRoleClaim <string> {
                ClaimType = "Se Fravær", ClaimValue = "Se Fravær", RoleId = "1", Id = 8
            }

                );
        }
Пример #2
0
 public EfWeekRepository(AlsDbContext context)
 {
     this.context = context;
 }
 public EfEducatorRepository(AlsDbContext context)
 {
     this.context = context;
 }
Пример #4
0
 public EfCourseRepository(AlsDbContext context)
 {
     this.context = context;
 }
Пример #5
0
 public EfAbsenceRepository(AlsDbContext context)
 {
     this.context = context;
 }
 public EfStudentRepository(AlsDbContext context)
 {
     this.context = context;
 }