示例#1
0
        public Task <TUser> FindByIdAsync(string userId)
        {
            var user = _userRepository.GetById(userId);

            if (user != null)
            {
                user.Roles  = _userRoleRepository.PopulateRoles(user.Id);
                user.Claims = _userClaimRepository.PopulateClaims(user.Id);
                user.Logins = _userLoginRepository.PopulateLogins(user.Id);
                return(Task.FromResult(user));
            }

            return(Task.FromResult(default(TUser)));
        }
示例#2
0
        public Task <TUser> FindByEmailAsync(string email)
        {
            if (email == null)
            {
                throw new ArgumentNullException(nameof(email));
            }

            var user = _userRepository.GetByEmail(email);

            if (user != null && !string.IsNullOrEmpty(user.Email))
            {
                user.Roles  = _userRoleRepository.PopulateRoles(user.Id);
                user.Claims = _userClaimRepository.PopulateClaims(user.Id);
                user.Logins = _userLoginRepository.PopulateLogins(user.Id);
                return(Task.FromResult(user));
            }
            return(Task.FromResult(default(TUser)));
        }