Пример #1
0
        public async Task <IActionResult> GetUserProjectsBySearchName([FromQuery] PaginationFilter filter, int idUser,
                                                                      [FromQuery(Name = "projectName")] string SearchName)
        {
            var route       = Request.Path.Value;
            var validFilter = new PaginationFilter(filter.PageNumber, DefaultPageSize);
            var projectList = await _projectMemberService.GetProjectByNameSearch(idUser, SearchName);

            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));
        }