public IEnumerable <TaskRequest> GetAllTasks() { var parentTasks = _parentTaskBusiness .GetAll() .ToList(); var projects = _projectBusiness.GetAll(); var tasks = _taskRepository.GetAll(); var users = _userRepository.GetAll(); var models = new List <TaskRequest>(); foreach (var task in tasks) { var parentTaskName = string.Empty; var status = "No"; var projectName = string.Empty; var managerName = string.Empty; var managerId = 0; var pt = parentTasks.FirstOrDefault(p => p.ParentTaskId == task.ParentTaskId); if (pt != null) { parentTaskName = pt.ParentTaskName; } var project = projects.FirstOrDefault(p => p.ProjectId == task.ProjectId); if (project != null) { projectName = project.ProjectName; } var user = users.FirstOrDefault(p => p.TaskId == task.TaskId); if (user != null) { managerName = string.Format("{0} {1}", user.FirstName, user.LastName); managerId = user.UserId; } models.Add(new TaskRequest { TaskId = task.TaskId, TaskName = task.Title, ParentTaskName = parentTaskName, ParentTaskId = task.ParentTaskId, StartDate = task.StartDate, EndDate = task.EndDate, ProjectId = task.ProjectId, ProjectName = projectName, Priority = task.Priority, ManagerId = managerId, ManagerName = managerName, Status = string.IsNullOrEmpty(task.Status) ? status : task.Status }); } return(models); }
public IEnumerable <ProjectViewModel> GetAll() { return(_projectBusiness.GetAll()); }
public IEnumerable <ProjectRequest> GetAll() { return(_projectBusiness.GetAll()); }
public ActionResult GetAll() { List <ProjectBo> projectBos = projectBusiness.GetAll(); return(Ok(projectBos)); }