Exemplo n.º 1
0
        public override VerbViewBase Run()
        {
            var activeTasks = _todoTaskRepository.GetActiveTasksOrderedByAddedDate();
            IReadOnlyList <Category> categories = _categoryRepository.GetAllCategories();
            var completedTasks = Options.ShowCompletedTasks
                ? _todoTaskRepository.GetCompletedTasksOrderedByAddedDate()
                : new List <TodoTask>();

            return(new ListTasksView(Options, activeTasks, completedTasks, categories, _priorityColorChooser));
        }
Exemplo n.º 2
0
        public override VerbViewBase Run()
        {
            // TODO By decreasing the number of query calls, the performance can be improved here, but heck yeah for now.
            // I will consider performance tuning in the next iteration.
            var tasks       = _todoTaskRepository.GetActiveTasksOrderedByAddedDate();
            var activeTasks = tasks.Where((t, i) => Options.TaskIds.Contains(i)).ToList();

            foreach (var activeTask in activeTasks)
            {
                _todoTaskRepository.MarkComplete(activeTask);
            }

            return(new CompleteTaskView(activeTasks));
        }
Exemplo n.º 3
0
        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));
        }