public async Task CreateUsersAsync() { // The Admin User TeamTasksUser admin = await UM.FindByNameAsync("admin"); if (admin == null) { admin = new TeamTasksUser { UserName = "******", Email = "*****@*****.**", EmailConfirmed = true }; var res = await UM.CreateAsync(admin, "Aaa000$"); if (res.Succeeded) { await UM.AddToRoleAsync(admin, "member"); await UM.AddToRoleAsync(admin, "admin"); } } await CreateMemberUserAsync("user1"); await CreateMemberUserAsync("user2"); await CreateMemberUserAsync("user3"); await CreateMemberUserAsync("user4"); await CreateMemberUserAsync("user5"); }
private async Task CreateMemberUserAsync(string username, params string[] roleNames) { TeamTasksUser user = await UM.FindByNameAsync(username); if (user == null) { user = new TeamTasksUser { UserName = username, Email = $"{username}@teamtasks.net", EmailConfirmed = true }; var res = await UM.CreateAsync(user, "Aaa000$"); if (res.Succeeded) { await UM.AddToRoleAsync(user, "member"); } } }