Пример #1
0
        public Task CreateAsync(string username, string emailAddress, string password, AccountCreationChallenge challenge, string challengeAnswer)
        {
            if (username == null)
            {
                throw new ArgumentNullException(nameof(username));
            }
            if (emailAddress == null)
            {
                throw new ArgumentNullException(nameof(emailAddress));
            }
            if (password == null)
            {
                throw new ArgumentNullException(nameof(password));
            }
            if (challenge == null)
            {
                throw new ArgumentNullException(nameof(challenge));
            }
            if (challengeAnswer == null)
            {
                throw new ArgumentNullException(nameof(challengeAnswer));
            }
            return(Task.Run(() =>
            {
                var resp = Rest.DoPost("Account/Create", new
                {
                    ChallengeId = challenge.Id,
                    ChallengeAnswer = challengeAnswer,
                    EmailAddress = emailAddress,
                    Username = username,
                    Password = password
                });

                if (resp.Error)
                {
                    throw new Exceptions.AccountCreationException(resp.Message);
                }
            }));
        }
Пример #2
0
 public void Create(string username, string emailAddress, string password, AccountCreationChallenge challenge, string response) =>
 CreateAsync(username, emailAddress, password, challenge, response).Wait();