Created
January 22, 2014 17:14
-
-
Save wayne-o/8562846 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public virtual async Task<AccountsResponse> RegisterAsync(string username, string emailAddress, string password, string twitterId = "", string facebookId = "") | |
{ | |
// TODO : Validate the arguments | |
AccountsResponse accountResponse = null; | |
List<KeyValuePair<string, string>> values = new List<KeyValuePair<string, string>> (); | |
values.Add(new KeyValuePair<string, string>("emailaddress", emailAddress)); | |
values.Add(new KeyValuePair<string, string>("username", username)); | |
values.Add(new KeyValuePair<string, string>("password", password)); | |
values.Add(new KeyValuePair<string, string>("twitterId", twitterId)); | |
values.Add(new KeyValuePair<string, string>("facebookId", facebookId)); | |
try | |
{ | |
var response = await HttpClient.PostAsync(PixtureItConfig.AccountsUri + "/Register/", new FormUrlEncodedContent(values)); | |
var content = await response.Content.ReadAsStringAsync(); | |
accountResponse = JsonConvert.DeserializeObject<AccountsResponse>(content); | |
} | |
catch(Exception ex) | |
{ | |
throw new ServiceException("Accounts::RegisterByEmailAddressAsync", ex.InnerException); | |
} | |
return accountResponse; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment