コード例 #1
0
        public async Task <IActionResult> OnGetAsync(string categoryName)
        {
            var productList = await _catalogApi.GetCatalog();

            CategoryList = productList.Select(p => p.Category).Distinct();

            if (!string.IsNullOrEmpty(categoryName))
            {
                ProductList = await _catalogApi.GetCatalogByCategory(categoryName);

                SelectedCategory = categoryName;
            }
            else
            {
                ProductList = productList;
            }

            return(Page());
        }
コード例 #2
0
        public async Task <IActionResult> OnGetAsync(string category)
        {
            CategoryList = new List <string>()
            {
            };

            if (!string.IsNullOrWhiteSpace(category))
            {
                ProductList = await catalogApi.GetCatalogByCategory(category);

                // SelectedCategory = CategoryList.FirstOrDefault(c => c.Id == categoryId.Value)?.Name;
            }
            else
            {
                ProductList = await catalogApi.GetCatalog();
            }

            return(Page());
        }