public User FindUserById(string id) { var user = _userManager.FindById(id); if (user != null && user.AllRoles.Count == 0) { var roles = _userManager.GetRoles(user.Id); user.AllRoles = _roleManager.Roles.Where(r => roles.Contains(r.Name)).ToList(); } return(user); }