public async Task <PagedResult <ProductViewModel> > GetAllByCategoryId(string languageId, GetPublicProductPagingrequest request)
        {
            //1. select product
            var query = from p in _context.products
                        join pt in _context.ProductTranslations on p.Id equals pt.ProductId
                        join pic in _context.ProductInCategories on p.Id equals pic.ProductId
                        join c in _context.Categories on pic.CategoryId equals c.Id
                        where pt.LanguageId == languageId
                        select new { p, pt, pic };

            //2. fillter
            if (request.CategoryId.HasValue && request.CategoryId.Value > 0)
            {
                query = query.Where(x => x.pic.CategoryId == request.CategoryId);
            }
            //3. paging
            int totalRow = await query.CountAsync();

            var data = await query.Skip((request.PageIndex - 1) *request.PageSize).Take(request.PageSize)
                       .Select(x => new ProductViewModel()
            {
                Id             = x.p.Id,
                Name           = x.pt.Name,
                DateCreated    = x.p.DateCreated,
                Description    = x.pt.Description,
                Details        = x.pt.Details,
                LanguageId     = x.pt.LanguageId,
                OriginalPrice  = x.p.OriginalPrice,
                Price          = x.p.Price,
                SeoAlias       = x.pt.SeoAlias,
                SeoDescription = x.pt.SeoDescription,
                Stock          = x.p.Stock,
                ViewCount      = x.p.ViewCount,
            }).ToListAsync();

            //4. select and projection
            var pageResult = new PagedResult <ProductViewModel>()
            {
                Items       = data,
                TotalRecord = totalRow
            };

            return(pageResult);
        }
        public async Task <IActionResult> GetPaging(string languageId, [FromQuery] GetPublicProductPagingrequest request)
        {
            var product = await _publicProductService.GetAllByCategoryId(languageId, request);

            return(Ok(product));
        }