public Account GetAccount(string accessToken)
        {
            //var result = _facebookClient.Get<dynamic>(accessToken, "me", "fields=id,name,first_name,last_name");
            var result = _facebookClient.Get <dynamic>(accessToken, "me", "fields=id,name,first_name,last_name");

            if (result == null)
            {
                return(new Account());
            }

            var account = new Account
            {
                Id = result.id,
                //Email = result.email,
                Name = result.name,
                //UserName = result.username,
                FirstName = result.first_name,
                LastName  = result.last_name,
                //Locale = result.locale
            };

            return(account);
        }
示例#2
0
 public string GetAccount(string customerId)
 {
     if (customerId != "")
     {
         dynamic account;
         try
         {
             account = _client.Get($"/{customerId}/", new
             {
                 fields = "account_id"
             });
         }
         catch (Exception ex)
         {
             account = _client.Get($"/act_{customerId}/", new { fields = "account_id" });
         }
         var businessAccount = JsonConvert.DeserializeObject <BusinessAccount>(account);
         return(businessAccount.Id);
     }
     else
     {
         throw new Exception("The customerId can't be empty");
     }
 }