public IActionResult NotDone() { List <Task> allTasks = _taskService.GetAllTasks() .Where(t => t.Status == Status.NotDone) .ToList(); List <TaskViewModel> notDone = new List <TaskViewModel>(); foreach (var task in allTasks) { TaskViewModel taskForList = new TaskViewModel { Title = task.Title, Description = task.Description, Priority = task.Priority, Status = task.Status, Type = task.Type, }; notDone.Add(taskForList); } NotDoneTasksViewModel model = new NotDoneTasksViewModel() { NotDone = notDone }; return(View(model)); }
public IActionResult NotDone() { var notDoneTasks = _Andrea.ToDoTasks.Where(t => t.Status == Status.NotDone).ToList(); NotDoneTasksViewModel notDone = new NotDoneTasksViewModel() { NotDone = notDoneTasks }; return(View(notDone)); }
public IActionResult Index() { List <ToDo> notDoneTodos = _todoService.GetAllToDos() .Where(t => t.Status == Status.NotDone) .ToList(); List <ToDoViewModel> notDoneView = new List <ToDoViewModel>(); foreach (var toDo in notDoneTodos) { List <SubTaskViewModel> subTaskView = new List <SubTaskViewModel>(); foreach (var subtask in toDo.SubTasks) { subTaskView.Add(new SubTaskViewModel() { Title = subtask.Title, Descrition = subtask.Descrition, SubStatus = subtask.SubStatus }); } notDoneView.Add(new ToDoViewModel() { Id = toDo.Id, Title = toDo.Title, Descrition = toDo.Descrition, ImporanceOfTask = toDo.ImporanceOfTask, TypeOfTodo = toDo.TypeOfToDo, Status = toDo.Status, SubTasks = subTaskView }); } NotDoneTasksViewModel model = new NotDoneTasksViewModel() { NotDoneTasks = notDoneView }; return(View(model)); }