Пример #1
0
 public ProfileViewModel(UserProfile profile, FacebookUser fbUser, IList<FacebookIdentity> friends,  IList<Invitation> invitationList, string title = "Profile")
     : base(profile)
 {
     UserProfile = profile;
     FacebookUser = fbUser;
     FacebookFriends = friends;
     Title = title;
     InvitationList = invitationList;
 }
Пример #2
0
        public void MergeFacebookProfile(UserProfile profile, FacebookUser facebookProfile)
        {
            profile.FacebookId = facebookProfile.Id;
            profile.Gender = facebookProfile.Gender;
            profile.FacebookProfilePictureUrl = facebookProfile.Picture != null ? facebookProfile.Picture.Url : "";

            if (profile.Email.IsEmpty()) profile.Email = facebookProfile.Email;
            if (profile.FirstName.IsEmpty()) profile.FirstName = facebookProfile.First_Name;
            if (profile.LastName.IsEmpty()) profile.LastName = facebookProfile.Last_Name;

            _profilesRepository.Update(profile);
            _unit.Commit();
            Log.InfoFormat("Merging Facebook user data to UserProfile. UserId={0} FacebookId={1}", profile.User.Id, facebookProfile.Id);
        }