public async Task <IActionResult> SetUserRole([FromBody] SetUserRoleRequest model) { ApplicationUser user = await _roleservice.FindByEmailAsync(model.Email); string roleName = string.Empty; if (user == null) { return(Ok("User Not Found....")); } string userName = user.UserName != null ? user.Email : user.UserName; // Find Role Using Role Name in AspNetRole Table ApplicationRole applicationRole = await _roleservice.FindByNameAsync(model.ApplicationRoleName.ToUpper()); //ApplicationRole applicationRole = await _roleManager.FindByIdAsync(model.ApplicationRoleId); IdentityResult roleResult = null; if (applicationRole != null) { roleName = applicationRole.Name; if (ModelState.IsValid) { // Add Role With Specific user roleResult = await _roleservice.AddToRoleAsync(user, applicationRole.Name); return(Ok($"SuccessFully Set Role {roleName} For User {userName} in AspNetUserRoles Table")); } } return(Ok("UnExpected Errors !!!")); }