Ejemplo n.º 1
0
        private async void DeleteList()
        {
            try
            {
                var confirmPopup = new ConfirmationPopupPage()
                {
                    Header            = "Delete",
                    Body              = "Are you sure you want to delete this list?",
                    ConfirmButtonText = "Yes"
                };

                await _popupNavigation.PushAsync(confirmPopup);

                if (!await confirmPopup.Task)
                {
                    return;
                }

                await _toDoService.DeleteList(_list.Id);

                await Navigation.PopAsync();
            }
            catch (Exception ex)
            {
                Debug.Fail("Error deleting list", ex.Message);
            }
        }
Ejemplo n.º 2
0
        private async void Delete(ToDoList list)
        {
            try
            {
                var confirmPopup = new ConfirmationPopupPage()
                {
                    Header            = "Delete",
                    Body              = "Are you sure you want to delete this list?",
                    ConfirmButtonText = "Yes"
                };

                await _popupNavigation.PushAsync(confirmPopup);

                if (!await confirmPopup.Task)
                {
                    return;
                }

                await _toDoService.DeleteList(list.Id);

                Lists.Remove(list);

                OnPropertyChanged(nameof(Lists)); // To show/hide list
            }
            catch (Exception ex)
            {
                Debug.Fail("Error deleting list", ex.Message);
            }
        }
Ejemplo n.º 3
0
        public async Task Test_RemoveList()
        {
            await _toDoService.CreateList(_mockList_1);

            await _toDoService.DeleteList(_mockList_1.Id);

            var lists = await _toDoService.GetAllLists();

            Assert.That(lists.Count(x => x.Id == _mockList_1.Id), Is.EqualTo(0));
        }