private async Task <List <RecordListBoxTasks> > GetRecordListBoxes() { var statuses = await _statusRepository.GetStatuses(); var tasks = await _taskRepository.GetTasksFromProject(Consts.ProjectId); var records = new List <RecordListBoxTasks>(); foreach (Task task in tasks) { Project project = await _projectRepository.GetProject(task.ProjectId); var record = new RecordListBoxTasks() { TaskId = task.Id, UserId = task.UserId, ProjectId = project.Id, UserName = (await _userRepository.GetUser(null, task.UserId)).Login, ProjectName = project.Name, TaskName = task.Name, FinishDate = task.EndDate.ToString(), StartDate = task.BeginDate.ToString(), Status = statuses.First(c => c.Id == task.StatusId).Name, Foreground = CheckTime(task.EndDate) }; records.Add(record); } CheckCountTasks(records); return(records.OrderByDescending(c => c.Status).ThenByDescending(c => c.StartDate).ToList()); }
private async Task <List <RecordListBoxTasks> > GetRecordListBoxes() { var statuses = await _statusRepository.GetStatuses(); var tasks = await _projectRepository.GetTasksFromUser((await _userRepository.GetUser(Consts.UserName)).Id); var records = new List <RecordListBoxTasks>(); foreach (SharedServicesModule.Models.Task task in tasks) { Project project = await _projectRepository.GetProject(task.ProjectId); var record = new RecordListBoxTasks() { TaskId = task.Id, ProjectId = project.Id, ProjectName = project.Name, TaskName = task.Name, FinishDate = task.EndDate.ToString(), Status = statuses.First(c => c.Id == task.StatusId).Name, Foreground = CheckTime(task.EndDate) }; records.Add(record); } CheckCountProjects(records); return(records.OrderByDescending(c => c.Status).ToList()); }