@page "/shop" @inject ProductAPIConsumer productService @inject CategoryAPIConsumer categoryService @inject NavigationManager nav @using Common

Discover Premium Quality

Explore our curated collection of top-tier products and exclusive bundles designed to elevate your lifestyle.

@foreach (var product in products) { }
@code { public Pagination pagination { get; set; } = new() { CurrentPage = 1, PageSize = 15 }; public ProductFilter productFilter { get; set; } = new ProductFilter(); List products = new List(); [Parameter, SupplyParameterFromQuery] public string? CategoryId { get; set; } [Parameter, SupplyParameterFromQuery] public bool? IsBundle { get; set; } protected async override Task OnParametersSetAsync() { bool changed = false; if (!string.IsNullOrEmpty(CategoryId) && Guid.TryParse(CategoryId, out var categoryGuid)) { productFilter.CategoryId = categoryGuid; changed = true; } if (IsBundle.HasValue) { productFilter.IsBundle = IsBundle.Value; changed = true; } if (changed) { await OnSearchProduct(); } } protected async override Task OnInitializedAsync() { if (string.IsNullOrEmpty(CategoryId)) { await OnSearchProduct(); } } async Task OnSearchProduct(int pageNumber = 1) { pagination.CurrentPage = pageNumber; var result = await productService.FetchProduct(productFilter, pagination); products = result.Item1; pagination.ItemsCount = result.Item2; } }