TourIAm/TIAMSharedUI/Pages/User/SysAdmins/SysAdminComponent.razor

50 lines
1.2 KiB
Plaintext

@using BlazorAnimation
@using TIAMSharedUI.Shared
@using TIAMWebApp.Shared.Application.Models;
@using TIAMWebApp.Shared.Application.Interfaces;
@using TIAMWebApp.Shared.Application.Services
@inject ExchangeRateService ExchangeRateService
<div class="row py-3">
<div class=" col-12 col-xl-3 col-lg-6">
<div class="card card-admin" style="border-radius: 16px;">
<h3>Exchange Rate</h3>
@if (exchangeRate == null)
{
<p><em>Loading...</em></p>
}
else
{
<p>Current EUR to HUF exchange rate: @exchangeRate.EURtoHUF</p>
<input type="number" @bind="exchangeRate.EURtoHUF" step="0.01" />
<button @onclick="SaveExchangeRate">Save</button>
}
</div>
</div>
</div>
@code {
private ExchangeRate exchangeRate;
protected override async Task OnInitializedAsync()
{
exchangeRate = await ExchangeRateService.GetExchangeRateAsync();
}
private async Task SaveExchangeRate()
{
await ExchangeRateService.SetExchangeRateAsync(exchangeRate);
}
}