public static async Task SeedUsers(UserManager <User> userManager, KanbanContext kanbanContext) { string password = "******"; string email = "*****@*****.**"; if (await userManager.FindByNameAsync(email) == null) { User user = new User(); user.Email = email; user.UserName = email; user.Name = "Misha"; IdentityResult result = await userManager.CreateAsync(user, password); if (result.Succeeded) { await userManager.AddToRoleAsync(user, "Admin"); await userManager.AddToRoleAsync(user, "Worker"); } } }
public static async Task SeedData(UserManager <User> userManager, RoleManager <IdentityRole> roleManager, KanbanContext deratContext) { await SeedRoles(roleManager); await SeedUsers(userManager, deratContext); }