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
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:
@@ -127,8 +127,8 @@ public class DiscountProductService
|
||||
}
|
||||
}
|
||||
|
||||
public Task<DiscountProductListResult> GetTopSellingAsync(int count = 6)
|
||||
=> GetProductsAsync(page: 1, pageSize: count, sortBy: "SaleCount desc");
|
||||
public Task<DiscountProductListResult> GetTopSellingAsync(int count = 6, bool? inStock = null)
|
||||
=> GetProductsAsync(page: 1, pageSize: count, sortBy: "SaleCount desc", inStock: inStock);
|
||||
|
||||
public async Task<DiscountProductDetail?> GetByIdAsync(long productId)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user