feat: update product service to support in-stock filtering and enhance top-selling product retrieval
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 23m11s

- Modified `GetTopSellingAsync` methods in `ProductService` and `DiscountProductService` to include an optional `inStock` parameter for filtering products based on availability.
- Introduced a constant for the top product count in `Index.razor.cs` to improve maintainability and readability.
- Updated the product retrieval logic in `Index.razor.cs` to utilize the new in-stock filtering feature.

These changes enhance the product listing functionality by allowing users to view only in-stock top-selling products, improving the overall shopping experience.
This commit is contained in:
masoodafar-web
2026-06-30 00:17:30 +03:30
parent 81d139cdab
commit 37c7cebf92
4 changed files with 23 additions and 16 deletions
+5 -3
View File
@@ -24,6 +24,8 @@ public partial class Index : IDisposable
private LandingSettings? _settings;
// ── Top-selling product sections ──
private const int LandingTopProductCount = 6;
private List<Product> _topRegularProducts = new();
private List<DiscountProductCard> _topDiscountProducts = new();
private bool _loadingTopProducts = true;
@@ -65,9 +67,9 @@ public partial class Index : IDisposable
PopulateFromSettings();
_dataLoaded = true;
// Load top-selling products and blog posts in parallel
var topRegTask = ProductService.GetTopSellingAsync(6);
var topDiscTask = DiscountProductService.GetTopSellingAsync(6);
// Load top-selling in-stock products and blog posts in parallel
var topRegTask = ProductService.GetTopSellingAsync(LandingTopProductCount, inStock: true);
var topDiscTask = DiscountProductService.GetTopSellingAsync(LandingTopProductCount, inStock: true);
var featuredPostsTask = BlogPostService.GetFeaturedPostsAsync(2);
try