コード例 #1
0
        public void Delete(ToDoListEntity toDoListEntity)
        {
            if (toDoListEntity.Id == 0)
            {
                throw new Exception("Select a todolist to delete");
            }
            var todolist   = _toDoListRepository.GetById(toDoListEntity.Id);
            var todolistid = todolist.CategoryId;

            _toDoListRepository.Delete(todolist);
        }
コード例 #2
0
        internal ToDoList Delete(int id, string userId)
        {
            ToDoList original = GetById(id);

            if (userId != original.CreatorId)
            {
                throw new Exception("You cannot delete this.");
            }
            _repo.Delete(id);
            return(original);
        }
コード例 #3
0
        public async Task <bool> Handle(DeleteToDoListCommand request, CancellationToken cancellationToken)
        {
            Logger.LogInformation($"Received request to delete ame To Do List {request.Id}");

            var toDoList = await ToDoListRepository.Get(request.Id);

            if (toDoList == null)
            {
                throw new NotFoundException(request.Id, typeof(ToDoList));
            }

            await ToDoListRepository.Delete(toDoList.Id);

            return(true);
        }
コード例 #4
0
        public void RemoveToDoList(ToDoList deletedList)
        {
            ToDoListRepository toDoListRepository = new ToDoListRepository();

            toDoListRepository.Delete(deletedList);

            //Items also will be deleted from related list.
            ToDoItemRepository toDoItemRepository = new ToDoItemRepository();
            List <ToDoItem>    toDoItems          = GetItems(deletedList);

            foreach (ToDoItem item in toDoItems)
            {
                toDoItemRepository.Delete(item);
            }
        }
コード例 #5
0
ファイル: MainWindow.xaml.cs プロジェクト: cemduhan/ToDoApp
        private void MenuItemDelete_Click(object sender, RoutedEventArgs e)
        {
            int listId = 0;

            if (lbTodoList.SelectedItem != null)
            {
                listId = (lbTodoList.SelectedItem as ToDoList).ToDoListId;
            }
            else
            {
                return;
            }

            _toDoListRepository.Delete(listId);

            _toDoListRepository.Save();

            Populate();
            RefreshList();
        }
コード例 #6
0
        public async Task DeleteToDoList()
        {
            int deleteResult = await _toDoListRepository.Delete(1, 1);

            Assert.IsNotNull(deleteResult);
        }
コード例 #7
0
 public void DeletingProcess(ToDoList todolist)
 {
     itemDetailsService.DeletingToDoListItems(todolist);
     toDoListRep.Delete(todolist);
 }