예제 #1
0
 private static void AddRoles(PandaDbContext dbContext)
 {
     if (!dbContext.Roles.Any())
     {
         foreach (var role in Roles)
         {
             dbContext.Roles.Add(role);
             dbContext.SaveChanges();
         }
     }
 }
예제 #2
0
 public static void SeedData(PandaDbContext dbContext, UserManager <ApplicationUser> userManager)
 {
     dbContext.Database.EnsureCreated();
     AddRoles(dbContext);
 }