Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
        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);
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 5
0
        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();
        }
Exemplo n.º 6
0
        public async Task DeleteToDoList()
        {
            int deleteResult = await _toDoListRepository.Delete(1, 1);

            Assert.IsNotNull(deleteResult);
        }
Exemplo n.º 7
0
 public void DeletingProcess(ToDoList todolist)
 {
     itemDetailsService.DeletingToDoListItems(todolist);
     toDoListRep.Delete(todolist);
 }