public IDataResult <ProjectGeneralDto> GetProjectByProjectID(int projectID) { var getProject = _projectService.GetByID(projectID).Data; var getAllProjectSection = _projectSectionService.GetByProjectID(getProject.ProjectID).Data; List <ProjectSectionKeepListDepartmentDto> projectSectionKeepList = new List <ProjectSectionKeepListDepartmentDto>(); foreach (var projectSection in getAllProjectSection) { var getListDepartments = _projectSectionDepartmentService.GetBySectionID(projectSection.ProjectSectionID).Data; ProjectSectionKeepListDepartmentDto projectSectionKeepListDepartmentDto = new ProjectSectionKeepListDepartmentDto() { projectSection = projectSection, projectSectionDepartmentDtos = getListDepartments }; projectSectionKeepList.Add(projectSectionKeepListDepartmentDto); } ProjectGeneralDto projectGeneralDto = new ProjectGeneralDto() { ProjectDetailDto = getProject, projectSectionKeepListDepartments = projectSectionKeepList }; return(new SuccessDataResult <ProjectGeneralDto>(projectGeneralDto)); }
public ActionResult GetBySectionID(int sectionID) { var result = _projectSectionDepartmentService.GetBySectionID(sectionID); if (result.Data != null) { return(Ok(result)); } return(BadRequest(result)); }