How to get query string at PrepareProductOverviewModelsAsync

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
1 anno tempo fa
I want to get query string in function :


  
public virtual async Task<IEnumerable<ProductOverviewModel>> PrepareProductOverviewModelsAsync(IEnumerable<Product> products,
            bool preparePriceModel = true, bool preparePictureModel = true,
            int? productThumbPictureSize = null, bool prepareSpecificationAttributes = false,
            bool forceRedirectionAfterAddingToCart = false)
        {
            if (products == null)
                throw new ArgumentNullException(nameof(products));
            var models = new List<ProductOverviewModel>();
         // GET QUERY STRING HERE  
            foreach (var product in products)
            {
                var model = new ProductOverviewModel
                {
                    Id = product.Id,
                    Name = await _localizationService.GetLocalizedAsync(product, x => x.Name),
                    ShortDescription = await _localizationService.GetLocalizedAsync(product, x => x.ShortDescription),
                    FullDescription = await _localizationService.GetLocalizedAsync(product, x => x.FullDescription),
                    SeName = await _urlRecordService.GetSeNameAsync(product),
                    Sku = product.Sku,
                    ProductType = product.ProductType,
                    Image1 = product.Image1,
                    Image2=product.Image2,
                    Image3=product.Image3,
                    MarkAsNew = product.MarkAsNew &&
                        (!product.MarkAsNewStartDateTimeUtc.HasValue || product.MarkAsNewStartDateTimeUtc.Value < DateTime.UtcNow) &&
                        (!product.MarkAsNewEndDateTimeUtc.HasValue || product.MarkAsNewEndDateTimeUtc.Value > DateTime.UtcNow)
                };


}


But this :
System.Web.HttpContext.Current.Request.QueryString["yourstring"]


Does not work how to get querystring here?
1 anno tempo fa
Try using the  IWebHelper ...
_webHelper.GetThisPageUrl(includeQueryString: true)
1 anno tempo fa
Thanx works ! :)
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.