예제 #1
0
        public bool CreateOrUpdateGithubUser(string email, int githubId, string accessToken)
        {
            if (_userGateway.FindByGithubId(githubId) != null)
            {
                _userGateway.UpdateGithubToken(githubId, accessToken);
                return(false);
            }
            User user = _userGateway.FindByEmail(email);

            if (user != null)
            {
                _userGateway.AddGithubToken(user.UserId, githubId, accessToken);
                return(false);
            }
            _userGateway.CreateGithubUser(email, githubId, accessToken);
            return(true);
        }
예제 #2
0
        public bool CreateOrUpdateGithubUser(string email, string accessToken)
        {
            User user = _userGateway.FindByEmail(email);

            if (user == null)
            {
                _userGateway.CreateGithubUser(email, accessToken);
                return(true);
            }
            if (user.GithubAccessToken == string.Empty)
            {
                _userGateway.AddGithubToken(user.UserId, accessToken);
            }
            else
            {
                _userGateway.UpdateGithubToken(user.UserId, accessToken);
            }
            return(false);
        }