Beispiel #1
0
        public async Task <ActionResult <Project> > GetAllProjectDetails(PagingParams pagingParams)
        {
            var projectDetailsList = await _projectService.GetAllProjects(pagingParams);

            var paginationHeaders = new PaginationHeaderModel
            {
                TotalCount  = projectDetailsList.TotalCount,
                TotalPages  = projectDetailsList.TotalPages,
                CurrentPage = projectDetailsList.CurrentPage,
                PageSize    = projectDetailsList.PageSize
            };

            Response.Headers.Add("pagination", JsonConvert.SerializeObject(paginationHeaders));

            string projectManager = string.Empty;
            var    listOfProject  = new List <GetProjectsDetailsDto>();

            foreach (var p in projectDetailsList)
            {
                var projectDetails = _mapper.Map <GetProjectsDetailsDto>(p);

                var projectMembersCount = await _projectManagementService.GetProjectMembersCount(p.Id);

                projectDetails.ProjectMembersCount = projectMembersCount;

                var projectRequirements = await _projectRequirementsService.GetProjectRequirements(p.Id);

                projectDetails.OpenRequirementsCount = projectRequirements.Count;

                listOfProject.Add(projectDetails);
            }
            return(Ok(listOfProject));
        }