示例#1
0
        private async System.Threading.Tasks.Task DeleteAccess(UserListAccess access)
        {
            AreBtnsEn = false;
            bool answer = await Application.Current.MainPage.DisplayAlert("Delete Access", "Are you sure? \n Remember: If you are only one admin, deleting cause removing list and all tasks", "Yes", "No");

            if (answer)
            {
                var deleteResult = await n_Restctrl.DeleteUserAccess(access.AccessID);

                if (deleteResult.StatusCode == HttpStatusCode.OK)
                {
                    await Refresh();

                    if (access.UserEmail == Constants.userToken.Username)
                    {
                        await Navigation.PushAsync(new MenuListsView());
                    }
                }
                else if (deleteResult.StatusCode == System.Net.HttpStatusCode.Unauthorized)
                {
                    await Application.Current.MainPage.DisplayAlert("Sorry", "You do not have permission to do this", "Ok");
                }
                else
                {
                    await Application.Current.MainPage.DisplayAlert("Sorry", "Something went wrong, check your connection", "Ok");
                }
            }
            AreBtnsEn = true;
        }