public async Task <BasePaginatedResponse <ProjectDto> > GetProjects(BaseQueryParameters parameters) { BasePaginatedResponse <ProjectDto> projectsPaginated = null; if (parameters.Search == "") { projectsPaginated = await _redisService.GetItemAsync <BasePaginatedResponse <ProjectDto> >($"projects.{parameters.ItemsPerPage}.{parameters.Page}"); } if (projectsPaginated == null) { var projectList = await _projectRepository.PaginateFiltered( offset : (parameters.Page - 1) *parameters.ItemsPerPage, itemsCount : parameters.ItemsPerPage, searchPhrase : parameters.Search ); var projectDtoList = _mapper.Map <IEnumerable <Project>, IEnumerable <ProjectDto> >(projectList); var rowsCount = await _projectRepository.GetFilteredDataCountAsync(parameters.Search); var pagesCount = (int)Math.Ceiling((decimal)rowsCount / parameters.ItemsPerPage); projectsPaginated = new BasePaginatedResponse <ProjectDto> { EntityList = projectDtoList, PagesCount = pagesCount }; if (parameters.Search == "") { await _redisService.SetItemAsync($"projects.{parameters.ItemsPerPage}.{parameters.Page}", projectsPaginated, 60); } } return(projectsPaginated); }