示例#1
0
        public void RemoveFollow(int followerId, int followedId)
        {
            var follow = Follows.SingleOrDefault(f => f.FollowedId == followedId && f.FollowerId == followerId);

            if (follow != null)
            {
                Follows.Remove(follow);
                SaveChanges();
            }
        }
示例#2
0
        public async void CancelFollow(object par)
        {
            if (!SettingHelper.Account.Logined && !await Utils.ShowLoginDialog())
            {
                Utils.ShowMessageToast("请先登录后再操作");
                return;
            }
            var item = par as FollowSeasonModel;

            try
            {
                var api     = followAPI.CancelFollowSeason(item.season_id.ToString());
                var results = await api.Request();

                if (results.status)
                {
                    var data = await results.GetJson <ApiResultModel <JObject> >();

                    if (data.success)
                    {
                        Follows.Remove(item);
                        if (Follows.Count == 0)
                        {
                            Nothing = true;
                        }
                        if (!string.IsNullOrEmpty(data.result["toast"]?.ToString()))
                        {
                            Utils.ShowMessageToast(data.result["toast"].ToString());
                        }
                        else
                        {
                            Utils.ShowMessageToast("操作成功");
                        }
                    }
                    else
                    {
                        Utils.ShowMessageToast(data.message);
                    }
                }
                else
                {
                    Utils.ShowMessageToast(results.message);
                }
            }
            catch (Exception ex)
            {
                var handel = HandelError <object>(ex);
                Utils.ShowMessageToast(handel.message);
            }
        }
示例#3
0
        private async Task SetSeasonStatus(FollowSeasonModel item, int status)
        {
            if (!SettingHelper.Account.Logined && !await Utils.ShowLoginDialog())
            {
                Utils.ShowMessageToast("请先登录后再操作");
                return;
            }
            try
            {
                var api     = followAPI.SetSeasonStatus(item.season_id.ToString(), status);
                var results = await api.Request();

                if (results.status)
                {
                    var data = await results.GetJson <ApiResultModel <JObject> >();

                    if (data.success)
                    {
                        Follows.Remove(item);
                        if (Follows.Count == 0)
                        {
                            Nothing = true;
                        }
                        Utils.ShowMessageToast("操作成功");
                    }
                    else
                    {
                        Utils.ShowMessageToast(data.message);
                    }
                }
                else
                {
                    Utils.ShowMessageToast(results.message);
                }
            }
            catch (Exception ex)
            {
                var handel = HandelError <object>(ex);
                Utils.ShowMessageToast(handel.message);
            }
        }