public async Task <PaginationResponse <ImageDto> > GetImages(string userId, PaginationRequest request) { var options = _mapper.Map <PaginationOptions>(request); var pagedData = await _unitOfWork.ImageRepository.GetImagesByUser(userId, options); return(await AddLikesCounts(pagedData)); }
public async Task <IActionResult> Get(PaginationRequest request) { IQueryable <ProductListDto> products = await Mediator.Send(new GetProductsQuery()); PaginationResponse response = products.ApplyPagination(request); return(Ok(response)); }
public PaginationResponse <CategoryVM> GetDataWithPagination(PaginationRequest request) { SearchPaginationRequest <CategoryVM> nrequest = new SearchPaginationRequest <CategoryVM>(request); PaginationResponse <CategoryVM> data = CategoryRepository.GetDataPaginated(nrequest); return(data); }
public PaginationResponse <TicketStatusVM> GetDataWithPagination(PaginationRequest request) { SearchPaginationRequest <TicketStatusVM> nrequest = new SearchPaginationRequest <TicketStatusVM>(request); PaginationResponse <TicketStatusVM> data = TicketStatusRepository.GetDataPaginated(nrequest); return(data); }
public async Task <PaginationResult <LiveStream> > GetLiveStreamsOnAirAsync(PaginationRequest request) { string url = _baseApiAddress + "livestreams/onair/"; url += PaginationHelper.CreateHttpQueryParams(request); return(await HttpClient.GetAsync <PaginationResult <LiveStream> >(url) .PaginationContinuation(request)); }
public async Task <PaginationResult <SiteLanguage> > GetLanguagesAsync(PaginationRequest request) { string url = _baseApiAddress + "languages/"; url += PaginationHelper.CreateHttpQueryParams(request); return(await HttpClient.GetAsync <PaginationResult <SiteLanguage> >(url) .PaginationContinuation(request)); }
public async Task <PaginationResult <Video> > GetUserVideosAsync(PaginationRequest request) { string url = _baseApiAddress + "user/videos/"; url += PaginationHelper.CreateHttpQueryParams(request); return(await HttpClient.GetAsync <PaginationResult <Video> >(url) .PaginationContinuation(request)); }
public async Task <PaginationResponse <UserWithRolesDto> > SearchUsersByName(string query, PaginationRequest request) { var options = _mapper.Map <PaginationOptions>(request); var pagedData = await _userManager.SearchByUsername(query, options); return(await ConvertToDtoWithRoles(pagedData)); }
public PaginationRequest Build() { var request = _request; _request = CreateDefaultPaginationRequest(); return(request); }
public IList <VisitorDetailsVM> GetAllVisitorsData(string globalSearch, int pageIndex, int pageSize, string sortField, string sortOrder, out int totalCount, int?organizationId) { var qryVisitors = _genericService.VisitorMaster.GetAll() .Where(item => (organizationId == null || (item.ApplicationUser.OrganizationId != null && item.ApplicationUser.OrganizationId == organizationId)) && (item.Address.Contains(globalSearch) || item.ContactNo.Contains(globalSearch) || item.EmailId.Contains(globalSearch) || item.IdNo.Contains(globalSearch) || item.VisitorName.Contains(globalSearch)) ) .Select(item => new VisitorDetailsVM { Id = item.Id, VisitorName = item.VisitorName, ContactAddress = item.Address, ContactNo = item.ContactNo, DOB = item.DOB ?? DateTime.MinValue, EmailAddress = item.EmailId, Gender = item.GenderId, IdNo = item.IdNo, Nationality = item.Nationality ?? 0, NationalityVal = item.CountryMaster.LookUpValue, TypeOfCard = item.TypeOfCardId, ImagePath = item.ProfilePicPath, IdentityImage1_Path = item.IdentityImage1_Path, IdentityImage2_Path = item.IdentityImage2_Path, IdentityImage3_Path = item.IdentityImage3_Path, CompanyName = item.CompanyName, CreatedOn = item.CreatedDate }) .AsQueryable(); //Default Sorting //if (string.IsNullOrEmpty(sortField)) //{ // sortField = "Id"; // sortOrder = "DESC"; //} //creating pager object to send for filtering and sorting var paginationRequest = new PaginationRequest { PageIndex = pageIndex, PageSize = pageSize, SearchText = globalSearch, Sort = new Sort { SortDirection = (sortOrder == "ASC" ? SortDirection.Ascending : SortDirection.Descending), SortBy = sortField } }; IList <VisitorDetailsVM> result = GenericSorterPager.GetSortedPagedList <VisitorDetailsVM>(qryVisitors, paginationRequest, out totalCount); return(result); }
public async Task <PaginationResponse <TOutput> > Paginate <TOutput, TEntity>( PaginationRequest request, List <TOutput> data, IQueryable <TEntity> queryCount) { var total = await queryCount.CountAsync(); return(Build(request, total, data)); }
public PaginatedResponse <Loan> GetLoansWithoutInsurance(PaginationRequest pagination) { // perform necessary joins, add predicates and construct query // Execute count query to get TotalRecords // Add skip & take & execute query to get current page data // Refer to EfRepository for sample implementation throw new NotImplementedException(); }
public void WhenPaginatingWithLimitLargerThan0() { var page = new PaginationRequest(1, 1).Paginate( new SortedQueryable <TestData>(TestDatas.AsQueryable(), new SortingHeader("Name", SortOrder.Ascending))); page.Items.Should().BeEquivalentTo(TestDatas.Skip(1).Take(1)); page.PaginationInfo.TotalItems.Should().Be(TestDatas.Count); }
public void WhenPaginatingWithLimitLessThan0() { var page = new PaginationRequest(1, -1).Paginate( new SortedQueryable <TestData>(TestDatas.AsQueryable(), new SortingHeader("Name", SortOrder.Ascending))); page.Items.Should().BeEmpty(); page.PaginationInfo.TotalItems.Should().Be(TestDatas.Count); }
public static IList <T> GetSortedPagedList <T>(IQueryable <T> source, PaginationRequest paging, out int totalCount, ChildLoad childLoad = ChildLoad.None) { totalCount = 0; //If not need paging, pass the null PaginationRequest if (paging == null) { var list = source.ToList(); totalCount = list.Count(); return(list); } source = source.Distinct(); //Call to build sorted paged query IQueryable <T> sortedPagedQuery = GetSortedPagedQuerable <T>(source, paging); //Call db one time to get data rows and count together if (childLoad == ChildLoad.None) { //Build one-call query from created regular query var pagedGroup = from sel in sortedPagedQuery select new PagedResultSet <T>() { PagedData = sel, TotalCount = source.Count() }; //Get the complete resultset from db. List <PagedResultSet <T> > pagedResultSet; try { pagedResultSet = pagedGroup.AsParallel().ToList(); } catch (NotSupportedException) { //In case not supported with EF version, do two calls instead totalCount = source.Count(); return(sortedPagedQuery.ToList()); } //Get data and total count from the resultset IEnumerable <T> pagedList = new List <T>(); if (pagedResultSet.Count() > 0) { totalCount = pagedResultSet.First().TotalCount; pagedList = pagedResultSet.Select(s => s.PagedData); } //Remove the wrapper reference pagedResultSet = null; return(pagedList.ToList()); } //Call db twice when childLoad == Include or else else { totalCount = source.Count(); return(sortedPagedQuery.ToList()); } }
public async Task GetShowPaginated_OK() { var request = new PaginationRequest { Index = 2, ItemsPerPage = 10 }; var pagination = await _apiClient.GetShowsPaginated(request); Assert.NotEmpty(pagination?.Items); }
public async Task <IEnumerable <T> > ReadAllAsync(PaginationRequest paginationRequest) { _ = paginationRequest ?? throw new ArgumentNullException(nameof(paginationRequest)); return(await dataContext.Set <T>() .Take(paginationRequest.PageSize) .Skip((paginationRequest.PageNumber - 1) * paginationRequest.PageSize) .ToListAsync()); }
public async Task <IActionResult> GetInnerNodes(Guid?id, string type, [FromQuery] PaginationRequest request, string status = null) { Log.Information($"Getting nodes from id {id}"); var list = await GetNodesPagedList(id ?? (UserId ?? Guid.Empty), type, request, status); this.AddPaginationHeader(request, list, id.HasValue ? nameof(GetInnerNodes) : "GetNodesInRoot", id); return(Ok(list)); }
public async Task <PaginationResponse <Account> > ListAll(PaginationRequest paginationRequest, AccountStatusIds?accountStatusId, string accountNumber) { return(await _userContext.Accounts .Include(a => a.AccountStatus) .WhereWhenValueNotNull(accountStatusId, a => a.AccountStatusId == (long)accountStatusId) .WhereWhenValueNotNull(accountNumber, a => a.AccountNumber.Contains(accountNumber)) .OrderByDescending(a => a.CreatedOn) .ListByPaging(paginationRequest.PageSize, paginationRequest.PageNumber)); }
public PlaceSearchResult ByUri(PaginationRequest paginationRequest) { var searchRequest = _requestBuilder .WithLicenseInfo(paginationRequest.LicenseInfo) .WithUriPathAndQuery(paginationRequest.UriPathAndQuery) .Build(); return(RetrievePlacesFor(searchRequest)); }
private void WhenSearchingByPaginationUri() { _paginationRequest = new PaginationRequest { LicenseInfo = _aLicenseInfo, UriPathAndQuery = PaginationUri }; _placeSearchRetrievedByProvider = _provider.ByUri(_paginationRequest); }
public async Task <PaginationResponse <Member> > ListAll(PaginationRequest paginationRequest, string searchMemberName) { return(await _userContext.Members .Include(m => m.MemberExpense.BillFrequency) .Include(m => m.MemberSalary.PayFrequency) .WhereWhenValueNotNull(searchMemberName, m => m.Name.Contains(searchMemberName)) .OrderBy(m => m.Name) .ThenBy(m => m.CreatedOn) .ListByPaging(paginationRequest.PageSize, paginationRequest.PageNumber)); }
public ArtistReleases GetArtistReleases(int artistId, PaginationRequest paginationRequest = null) { Tuple <int, PaginationRequest> key = new Tuple <int, PaginationRequest>(artistId, paginationRequest); if (artistReleasesCache.ContainsKey(key)) { return(artistReleasesCache[key]); } return(artistReleasesCache[key] = this.discogs.GetArtistReleases(artistId, paginationRequest)); }
public SearchResults Search(SearchQuery query, PaginationRequest paginationRequest = null) { Tuple <SearchQuery, PaginationRequest> key = new Tuple <SearchQuery, PaginationRequest>(query, paginationRequest); if (searchCache.ContainsKey(key)) { return(searchCache[key]); } return(searchCache[key] = this.discogs.Search(query, paginationRequest)); }
public string CreatePageUri(PaginationRequest request, PaginationUriType uriType, string action, Guid?containerId = null, string filter = null, IEnumerable <string> fields = null) { int pageNumber = uriType == PaginationUriType.PreviousPage ? request.PageNumber - 1 : request.PageNumber + 1; return(_urlHelper.Link(action, new RouteValueDictionary { { "pageSize", request.PageSize }, { "pageNumber", pageNumber } })); }
private IEnumerable <TabEntryDto> GetActionsTab(DeviceConfig config, PaginationRequest pagination, SortRequest sort, IEnumerable <AdvancedFilterRequest> filter) { if (string.IsNullOrEmpty(sort.SortBy)) { sort.SortBy = "name"; } return(GetEntries(config, pagination, sort, filter, "actions")); }
public List <CompraRequest> GetPaginados(PaginationRequest request) { var allCompras = this._unitOfWork.CompraRepository.GetAll(); List <Compra> compras = allCompras .Skip(request.Page - 1) .Take(request.Rows).ToList(); return(this.comprasService.ConvertirComprasARequest(compras)); }
public JobListResponse ListJobs(CommonJobQueryFilters queryFilters, PaginationRequest paginationReq) { var response = Client.Jobs.ListAsync(rgName, rName, queryFilters, paginationReq, CommonTestHelper.GetCustomRequestHeaders()).Result; Assert.NotNull(response); Assert.NotNull(response.ItemList); Assert.Equal(response.StatusCode, HttpStatusCode.OK); return(response); }
public async Task <ActionResult> GetAllAsync([FromQuery] PaginationRequest request) { IEnumerable <Product> products = await productsService.GetAllAsync(request.startIndex, request.perPage); if (products != null) { return(Ok(mapper.Map <IEnumerable <Product>, IEnumerable <ProductResponse> >(products))); } return(NoContent()); }
public async Task <IActionResult> SearchUsers([Required] string query, [Required] int page, [Required] int itemCount) { var request = new PaginationRequest { ItemCount = itemCount, Page = page }; var response = await _usersService.SearchUsersByName(query, request); return(Ok(response)); }