예제 #1
0
        public InstaUser Convert()
        {
            if (SourceObject == null)
            {
                throw new ArgumentNullException($"Source object");
            }
            var shortConverter = ConvertersFabric.GetUserShortConverter(SourceObject);
            var user           = new InstaUser(shortConverter.Convert())
            {
                HasAnonymousProfilePicture = SourceObject.HasAnonymousProfilePicture,
                FollowersCount             = SourceObject.FollowersCount,
                FollowersCountByLine       = SourceObject.FollowersCountByLine,
                SearchSocialContext        = SourceObject.SearchSocialContext,
                SocialContext   = SourceObject.SocialContext,
                MutualFollowers = (int)System.Convert.ToDouble(SourceObject.MulualFollowersCount)
            };

            if (SourceObject.FriendshipStatus != null)
            {
                var freindShipStatusConverter =
                    ConvertersFabric.GetFriendShipStatusConverter(SourceObject.FriendshipStatus);
                user.FriendshipStatus = freindShipStatusConverter.Convert();
            }
            return(user);
        }
예제 #2
0
        public InstaUser Convert()
        {
            if (SourceObject == null)
            {
                throw new ArgumentNullException($"Source object");
            }
            var user = new InstaUser
            {
                InstaIdentifier = SourceObject.Id
            };

            if (!string.IsNullOrEmpty(SourceObject.FullName))
            {
                user.FullName = SourceObject.FullName;
            }
            if (!string.IsNullOrEmpty(SourceObject.ProfilePicture))
            {
                user.ProfilePicture = SourceObject.ProfilePicture;
            }
            if (!string.IsNullOrEmpty(SourceObject.UserName))
            {
                user.UserName = SourceObject.UserName;
            }
            if (!string.IsNullOrEmpty(SourceObject.Pk))
            {
                user.Pk = SourceObject.Pk;
            }
            if (SourceObject.Friendship != null)
            {
                user.FriendshipStatus = ConvertersFabric.GetFriendShipStatusConverter(SourceObject.Friendship)
                                        .Convert();
            }
            user.HasAnonymousProfilePicture = SourceObject.HasAnonymousProfilePicture;
            user.ProfilePictureId           = SourceObject.ProfilePictureId;
            user.IsVerified           = SourceObject.IsVerified;
            user.IsPrivate            = SourceObject.IsPrivate;
            user.UnseenCount          = SourceObject.UnseenCount;
            user.MutualFollowersCount = SourceObject.MutualFollowersCount;
            return(user);
        }