Files
FrontOffice/src/FrontOffice.Main/Pages/Gateway/CartChooser.razor.cs
T
masoodafar-web 6db83ccd90
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 4m55s
feat: full FrontOffice updates - discount store, blog, payment gateway, UI improvements
- Discount store pages (products, cart, orders, order detail)
- Blog pages and services
- Payment gateway callback page
- AppImage component, EmptyState, LoadingState, PageHeader
- DiscountCartService, DiscountOrderService, DiscountProductService
- BlogCategoryService, BlogPostService, SitePageService, ImageCacheService
- PhoneVerifyForm component
- Profile Hub page
- UI/UX improvements across all pages
- landing.js for homepage
- Config and routing updates
2026-02-16 00:51:39 +03:30

48 lines
1.3 KiB
C#

using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using FrontOffice.Main.Utilities;
namespace FrontOffice.Main.Pages.Gateway;
public partial class CartChooser : IDisposable
{
[Inject] private CartService CartService { get; set; } = default!;
[Inject] private DiscountCartService DiscountCartService { get; set; } = default!;
[Inject] private IJSRuntime JS { get; set; } = default!;
private int _cartCount;
private int _discountCartCount;
protected override async Task OnInitializedAsync()
{
await CartService.EnsureInitializedAsync();
await DiscountCartService.EnsureInitializedAsync();
_cartCount = CartService.Count;
_discountCartCount = DiscountCartService.Count;
CartService.OnChange += OnCartChanged;
DiscountCartService.OnChange += OnDiscountCartChanged;
}
private void OnCartChanged()
{
_cartCount = CartService.Count;
InvokeAsync(StateHasChanged);
}
private void OnDiscountCartChanged()
{
_discountCartCount = DiscountCartService.Count;
InvokeAsync(StateHasChanged);
}
public void Dispose()
{
CartService.OnChange -= OnCartChanged;
DiscountCartService.OnChange -= OnDiscountCartChanged;
}
private async Task GoBack() => await JS.InvokeVoidAsync("history.back");
}