public async Task <ActionResult <TodoTask> > DeleteTodoTask(int id) { if (!await _repo.Exists(id)) { return(NotFound()); } TodoTask todoTask = await _repo.Delete(id); //_context.TodoTask.Remove(todoTask); //await _context.SaveChangesAsync(); return(todoTask); }
public override VerbViewBase Run() { // For simplicity, we are using the order number of the task as the id of it. Otherwise, it would be // hard for the users to type the full id number. That's why the TaskOrder is mapped to ID even though // it is just a user construct. var activeTasks = _todoTaskRepository.GetActiveTasksOrderedByAddedDate(); var toBeCompletedTasks = activeTasks.Where((a, i) => Options.TaskIds.Contains(i)).ToList(); foreach (TodoTask task in toBeCompletedTasks) { _todoTaskRepository.Delete(task); } return(new RemoveTaskView(toBeCompletedTasks)); }
public override VerbViewBase Run() { if (Options.CategoryName.ToLower() != "inbox") { _categoryRepository.DeleteByName(Options.CategoryName); var activeTasks = _todoTaskRepository.GetActiveTasksByCategoryName(new Category() { Name = Options.CategoryName }); foreach (var task in activeTasks) { _todoTaskRepository.Delete(task); } } return(new RemoveCategoryView(Options)); }
public void Delete(TodoTask entity) { _todoTaskRepository.Delete(entity); }