u
This commit is contained in:
@@ -95,6 +95,15 @@
|
||||
{
|
||||
<MudChip T="string" Color="Color.Success" Variant="Variant.Filled" Size="Size.Small">پیشفرض</MudChip>
|
||||
}
|
||||
@if (!address.IsDefault)
|
||||
{
|
||||
<MudButton Variant="Variant.Text"
|
||||
Color="Color.Primary"
|
||||
Size="Size.Small"
|
||||
OnClick="() => SetAddressAsDefault(address.Id)">
|
||||
تنظیم به عنوان پیشفرض
|
||||
</MudButton>
|
||||
}
|
||||
</MudStack>
|
||||
<MudText Typo="Typo.body2" Class="mud-text-secondary">@address.Address</MudText>
|
||||
<MudText Typo="Typo.caption" Class="mud-text-secondary">کد پستی: @address.PostalCode</MudText>
|
||||
|
||||
@@ -102,6 +102,20 @@ public partial class Checkout
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private async Task SetAddressAsDefault(long addressId)
|
||||
{
|
||||
try
|
||||
{
|
||||
await UserAddressContract.SetAddressAsDefaultAsync(new() { Id = addressId });
|
||||
await LoadAddresses(); // Reload addresses to reflect the change
|
||||
Snackbar.Add("آدرس پیشفرض با موفقیت تغییر یافت.", Severity.Success);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Snackbar.Add($"خطا در تغییر آدرس پیشفرض: {ex.Message}", Severity.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ApplyDiscountCode()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(_discountCode))
|
||||
|
||||
Reference in New Issue
Block a user