Пример #1
0
        public Task <TUser> FindAsync(UserLoginInfo login)
        {
            if (login == null)
            {
                throw new ArgumentNullException("login");
            }

            var identityUserLogins = UserLoginRepository.GetByWhere(new Dictionary <string, object> {
                { "ProviderKey", login.ProviderKey },
                { "LoginProvider", login.LoginProvider }
            }).ToList();

            return(Task.FromResult(!identityUserLogins.Any() ? null : UserRepository.Get(identityUserLogins.First().UserId)));
        }
Пример #2
0
        public Task <IList <UserLoginInfo> > GetLoginsAsync(TUser user)
        {
            if (user == null)
            {
                throw new ArgumentNullException("user");
            }

            var logins = UserLoginRepository.GetByWhere(new Dictionary <string, object> {
                { "UserId", user.Id }
            })
                         .Select(x => new UserLoginInfo(x.LoginProvider, x.ProviderKey)).ToList();

            return(Task.FromResult <IList <UserLoginInfo> >(logins));
        }