Пример #1
0
        private async void ExecuteFollowUserCommand(string userid)
        {
            FollowUser follower  = FollowerUsers.FirstOrDefault(x => x.Id == userid);
            FollowUser following = FollowingUsers.FirstOrDefault(x => x.Id == userid);

            if (follower?.IsFollowing == true || following?.IsFollowing == true)
            {
                UserContentProvider user   = new UserContentProvider();
                FollowResult        result = await user.UnFollowUser(userid, GlobalValue.CurrentUserContext.UserId, GlobalValue.CurrentUserContext.MobileToken);

                if (result.Error == null || result.Error.Count == 0)
                {
                    if (follower != null)
                    {
                        follower.IsFollowing = false;
                    }
                    if (following != null)
                    {
                        following.IsFollowing = false;
                    }
                }
            }
            else
            {
                UserContentProvider user   = new UserContentProvider();
                FollowResult        result = await user.FollowUser(userid, GlobalValue.CurrentUserContext.UserId, GlobalValue.CurrentUserContext.MobileToken);

                if (result.Error == null || result.Error.Count == 0)
                {
                    if (follower != null)
                    {
                        follower.IsFollowing = true;
                    }
                    if (following != null)
                    {
                        following.IsFollowing = true;
                    }
                }
            }
        }