public async Task <IActionResult> OnPostFilteredProductsAsync(string productName, int pageNumber) { if (!string.IsNullOrEmpty(productName)) { ProductList = await _catalogApi.GetFilteredProducts(productName); } else { ProductList = await _catalogApi.GetProductByPage(pageNumber); } CategoryList = ProductList.Select(p => p.Category).Distinct(); return(Page()); }