public void OnGet(string id) { ProductId = id; ShowProduct = _context.PriceDetails.Any(e => e.CatalogEntryCode == id); if (ShowProduct) { // get price details for the product and sort by market->currency->date ProductPrices = _context.PriceDetails.AsNoTracking() .Where(p => p.CatalogEntryCode == ProductId) .OrderBy(p => p.MarketId) .ThenBy(p => p.CurrencyCode) .ThenBy(p => p.ValidUntil); OptimisedPrices = OptimisedPriceCalculator.Calculate(ProductPrices.ToList()); } }