public FBAccount Create(FBAccount account) { if (account.Id == 0) { throw new Exception("id can't be 0 or null"); } contextFBAccount.Add(account); return(account); }
public bool Equals(User second) { // If parameter is null return false: if ((object)second == null) { return(false); } // Return true if the fields match: return(FBAccount.Equals(second.FBAccount) || Id == second.Id); }
public void ReadFacebookData() { var facebookClient = new FacebookClient(); var facebookService = new FacebookService(facebookClient); //var getAccountTask = facebookService.GetAccountAsync(AuthenticationService.UserContext.IdpAccessToken); var getAccountTaskResult = Task.Run(() => facebookService.GetAccountAsync(AuthenticationService.UserContext.IdpAccessToken)).Result; //Task.WaitAll(getAccountTask); //FBAccount = getAccountTask.Result; FBAccount = getAccountTaskResult; this.OnPropertyChanged(); }
public override bool Equals(System.Object obj) { // If parameter is null return false. if (obj == null) { return(false); } // If parameter cannot be cast to Point return false. User second = obj as User; if ((System.Object)second == null) { return(false); } // Return true if the fields match: return(FBAccount.Equals(second.FBAccount) || Id == second.Id); }
public async Task <FBAccount> GetAccountAsync(string accessToken) { var account = new FBAccount(); try { //var result = await _facebookClient.GetAsync<dynamic>(accessToken, "me", "fields=id,name,email,first_name,last_name,age_range,birthday,gender,locale,picture"); var result = await _facebookClient.GetAsync <FBAccount>( accessToken, "me", "fields=id,name,email,first_name,last_name,age_range,birthday,gender,locale,picture"); if (result == null) { return(new FBAccount()); } account = result; //account = new FBAccount //{ // Id = result.id, // Email = result.email, // Name = result.name, // UserName = result.username, // FirstName = result.first_name, // LastName = result.last_name, // Locale = result.locale, // //Picture = result.picture //}; } catch (Exception ex) { Console.WriteLine(ex.Message); } return(account); }
public override int GetHashCode() { return(FBAccount.GetHashCode()); }