private PaginationWebsitesDto GetResultPageAndCountProperties(PaginationWebsiteRequestDto request) { var result = new PaginationWebsitesDto(); result.TotalRecordCount = _context.Websites.Where(x => x.IsDeleted == false).Count(); result.PageNumber = GetPageNumber(request.PageNumber, request.PageSize, result.TotalRecordCount); result.TotalPagesCount = (int)Math.Ceiling((double)result.TotalRecordCount / request.PageSize); return(result); }
private static Result <PaginationWebsiteResponse, ErrorResponse> GetResponse(PaginationWebsitesDto paginationEntityResult, IEnumerable <WebsiteResponse> responseRecords) { return(new Result <PaginationWebsiteResponse, ErrorResponse> { Success = new PaginationWebsiteResponse { PageNumber = paginationEntityResult.PageNumber, TotalPagesCount = paginationEntityResult.TotalPagesCount, TotalRecordCount = paginationEntityResult.TotalRecordCount, Records = responseRecords }, IsSuccess = true }); }
private async Task <List <WebsiteResponse> > GetResponseRecords(PaginationWebsitesDto paginationEntityResult) { var responseRecords = new List <WebsiteResponse>(); foreach (var record in paginationEntityResult.Records) { var path = record.FilePath; var image = await _fileService.DownloadImage(path); var reponseWebsite = _mapper.EntityToResponse(record, image); responseRecords.Add(reponseWebsite); } return(responseRecords); }