예제 #1
0
        public async Task <IActionResult> GetUserProjects([FromQuery] PaginationFilter filter, int idUser)
        {
            var route       = Request.Path.Value;
            var validFilter = new PaginationFilter(filter.PageNumber, DefaultPageSize);
            var projectList = await _projectMemberService.GetProjectsByIdUser(idUser);

            var projectsListWithPaging = projectList
                                         .Skip((validFilter.PageNumber - 1) * validFilter.PageSize)
                                         .Take(validFilter.PageSize)
                                         .ToList();

            var totalRecords = projectList.Count();

            var pagedResponse = PaginationHelper.CreatePagedReponse(projectsListWithPaging, validFilter, totalRecords,
                                                                    _uriService, route);

            return(Ok(pagedResponse));
        }