private async Task SeedAdminUsers() { var user = new AuthUser { UserName = "******", NormalizedUserName = "******", Email = "*****@*****.**", NormalizedEmail = "*****@*****.**", EmailConfirmed = true, LockoutEnabled = false, SecurityStamp = Guid.NewGuid().ToString() }; var roleStore = new RoleStore <AuthRole>(_tmContext); if (!_tmContext.Roles.Any(r => r.Name == SD.CanManageSite)) { await roleStore.CreateAsync(new AuthRole { Name = SD.CanManageSite, NormalizedName = SD.CanManageSite, Description = "Site Administrator" }); } if (!_tmContext.Users.Any(u => u.UserName == user.UserName)) { var password = new PasswordHasher <AuthUser>(); var hashed = password.HashPassword(user, "balda1234"); user.PasswordHash = hashed; await _userManager.CreateAsync(user); await _userManager.AddToRoleAsync(user, SD.CanManageSite); } await _tmContext.SaveChangesAsync(); }