예제 #1
0
        private void SeedRoles(KitKareDbContext context)
        {
            if (context.Roles.Any())
            {
                return;
            }

            context.Roles.AddOrUpdate(x => x.Name, new IdentityRole("Admin"));
            context.SaveChanges();
        }
예제 #2
0
        private void SeedAdmin(KitKareDbContext context)
        {
            var admin = new User
            {
                Email    = "*****@*****.**",
                UserName = "******"
            };

            this.userManager.Create(admin, "admin11");
            this.userManager.AddToRole(admin.Id, "Admin");

            context.SaveChanges();
        }
예제 #3
0
        private void SeedRegularUsers(KitKareDbContext context)
        {
            for (int i = 0; i < 10; i++)
            {
                var user = new User
                {
                    Email    = "*****@*****.**",
                    UserName = "******" + i
                };

                this.userManager.Create(user, "user11");
                seededUsersIds.Add(user.Id);
            }

            context.SaveChanges();
        }