Beispiel #1
0
        private void SeedUsers(ChooseMeDbContext context)
        {
            var userManager = new UserManager<User>(new UserStore<User>(context));
            var roleManager = new RoleManager<IdentityRole>(new RoleStore<IdentityRole>(context));

            //Create Role if it does not exist
            if (!roleManager.Roles.Any())
            {
                roleManager.Create(new IdentityRole(ControllersConst.AdminRole));
                roleManager.Create(new IdentityRole(ControllersConst.AdopterRole));
                roleManager.Create(new IdentityRole(ControllersConst.OrganizationRole));
            }

            if (!context.Users.Any())
            {
                CreateNewUser(userManager, roleManager, ControllersConst.AdminRole, "*****@*****.**", "123456");
            }
        }
Beispiel #2
0
        private void SeedUsers(ChooseMeDbContext context)
        {
            var userManager = new UserManager <User>(new UserStore <User>(context));
            var roleManager = new RoleManager <IdentityRole>(new RoleStore <IdentityRole>(context));

            //Create Role if it does not exist
            if (!roleManager.Roles.Any())
            {
                roleManager.Create(new IdentityRole(ControllersConst.AdminRole));
                roleManager.Create(new IdentityRole(ControllersConst.AdopterRole));
                roleManager.Create(new IdentityRole(ControllersConst.OrganizationRole));
            }

            if (!context.Users.Any())
            {
                CreateNewUser(userManager, roleManager, ControllersConst.AdminRole, "*****@*****.**", "123456");
            }
        }
Beispiel #3
0
 public static void Initialize()
 {
     Database.SetInitializer(new MigrateDatabaseToLatestVersion <ChooseMeDbContext, Configuration>());
     ChooseMeDbContext.Create().Database.Initialize(true);
 }
Beispiel #4
0
 public void Start(ChooseMeDbContext context)
 {
     SeedUsers(context);
 }
Beispiel #5
0
 public void Start(ChooseMeDbContext context)
 {
     SeedUsers(context);
 }