public static IEnumerable <TodoTask> GetTasks() { var tasks = TasksDAL.GetTasks(); foreach (var item in tasks) { if (item.Status == default(TodoTaskStatus)) { item.Status = TodoTaskStatus.New; } } return(tasks); }
// // GET: /Tasks/ public ActionResult Index(string id) { if (id != null) { ShowTask(Guid.Parse(id)); } List <Tasks> tasks = TasksDAL.GetTasks(); List <TaskViewModel> tasksViewModel = new List <TaskViewModel>(); List <int> numberOfWorkers = new List <int>(); foreach (var task in tasks) { tasksViewModel.Add( new TaskViewModel(task) ); numberOfWorkers.Add(TasksDAL.GetNumberOfUsersPerTask(task.TaskId)); } ViewBag.NumberOfWorkers = numberOfWorkers; return(View(tasksViewModel)); }