Exemplo n.º 1
0
        private void KickPlayer_Click(object sender, System.EventArgs e, MemberDetails member, int position)
        {
            AlertDialog.Builder alert = new AlertDialog.Builder(_activity);
            alert.SetTitle("Премахване на играч");
            alert.SetMessage("Сигурни ли сте, че искате да премахнете играча от отбора?");
            alert.SetPositiveButton("Да", async(senderAlert, args) =>
            {
                var response = await RestManager.KickPlayer(new KickPlayerRequest
                {
                    ClubId   = member.ClubId.Value,
                    PlayerId = member.Id
                });
                if (response.IsSuccessStatusCode)
                {
                    _players = RemoveItem(position);
                    NotifyItemRemoved(position);
                    if (ItemCount > 0)
                    {
                        NotifyItemRangeChanged(position, ItemCount);
                    }

                    Toast.MakeText(_activity, "Успешно премахнат играч", ToastLength.Long).Show();
                }
            });

            alert.SetNegativeButton("Не", (senderAlert, args) =>
            {
                return;
            });

            Dialog dialog = alert.Create();

            dialog.Show();
        }