Skip to content

Instantly share code, notes, and snippets.

@wayne-o
Created January 22, 2014 17:14
Show Gist options
  • Save wayne-o/8562846 to your computer and use it in GitHub Desktop.
Save wayne-o/8562846 to your computer and use it in GitHub Desktop.
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