Exemple #1
0
 public async Task<ActionResult> AddUserToRole(string mailId, string role)
 {
     ApplicationUser user = await _userManager.FindByEmailAsync(mailId);
     if (user == null)
     {
         user = await _userutils.CreateNonExistentUser(mailId);
     }
     if (await _roleManager.RoleExistsAsync(role) && !(await _userManager.IsInRoleAsync(user, role)))
     {
         await _userManager.AddToRoleAsync(user, role);
     }
     return Ok();
 }