public async Task <PagedList <IcProductRecord> > GetIcProductRecordPaged(IcProductRecordParams icProductRecordParams)
        {
            var icProductRecords = _icproductrecordrepository.GetEntitys();

            //auRecords = auRecords.Where(a => a.CategoryId == prProductParams.CategoryId && a.Name.Contains(prProductParams.Name));
            return(await PagedList <IcProductRecord> .CreatePagedList(icProductRecords, icProductRecordParams.PageSize, icProductRecordParams.PageNum));
        }
        private string CreateLink(PagedType pagedType, IcProductRecordParams icProductRecordParams)
        {
            switch (pagedType)
            {
            case PagedType.Previous:
                return(Url.Link(nameof(GetIcProductRecords), new
                {
                    PageNum = icProductRecordParams.PageNum - 1,
                    PageSize = icProductRecordParams.PageSize
                }));

            case PagedType.Next:
                return(Url.Link(nameof(GetIcProductRecords), new
                {
                    PageNum = icProductRecordParams.PageNum + 1,
                    PageSize = icProductRecordParams.PageSize
                }));
            }
            return(string.Empty);
        }
        public async Task <ActionResult <IEnumerable <IcProductRecordDto> > > GetIcProductRecords([FromQuery] IcProductRecordParams icProductRecordParams)
        {
            var res  = new MessageModel <IEnumerable <IcProductRecordDto> >();
            var list = await _icProductRecordServices.GetIcProductRecordPaged(icProductRecordParams);

            string previousLink = list.HasPrevious ? CreateLink(PagedType.Previous, icProductRecordParams) : null;
            string nextLink     = list.HasNext ? CreateLink(PagedType.Next, icProductRecordParams) : null;
            var    pagination   = new
            {
                currentPage = list.PageNum,
                totalPage   = list.TotalPage,
                totalCount  = list.TotalCount,
                previousLink,
                nextLink
            };

            HttpContext.Response.Headers.Add("X-Pagination", JsonConvert.SerializeObject(pagination));
            res.Data = _mapper.Map <IEnumerable <IcProductRecordDto> >(list);
            return(Ok(res));
        }