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); }
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); }
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); } }
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(); }
public async Task DeleteToDoList() { int deleteResult = await _toDoListRepository.Delete(1, 1); Assert.IsNotNull(deleteResult); }
public void DeletingProcess(ToDoList todolist) { itemDetailsService.DeletingToDoListItems(todolist); toDoListRep.Delete(todolist); }