66 lines
1.9 KiB
Plaintext
66 lines
1.9 KiB
Plaintext
@page "/Accounts/Delete/{AccountId}"
|
|
|
|
@using Gremlin_BlazorServer.Data.EntityClasses;
|
|
@using Gremlin_BlazorServer.Services;
|
|
|
|
@inject AccountService AccountService
|
|
@inject NavigationManager NavigationManager
|
|
|
|
<h2>Delete Employee</h2>
|
|
<hr />
|
|
<h3>Are you sure want to delete this?</h3>
|
|
<form>
|
|
<div class="row">
|
|
<div class=" col-md-8">
|
|
<div class="form-group">
|
|
<label>AccountId:</label>
|
|
<label>@account.AccountId</label>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>AccountName:</label>
|
|
<label>@account.AccountName</label>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Street:</label>
|
|
<label>@account.Street</label>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>ZIP:</label>
|
|
<label>@account.Zip</label>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>City:</label>
|
|
<label>@account.City</label>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-md-4">
|
|
<div class="form-group">
|
|
<input type="button" class="btn btn-danger" @onclick="@DeleteAccount" value="Delete" />
|
|
<input type="button" class="btn btn-primary" @onclick="@Cancel" value="Cancel" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
@code {
|
|
[Parameter]
|
|
public string AccountId { get; set; } = default!;
|
|
Account account = new();
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
account = await Task.Run(() => AccountService.GetAccountAsync(Convert.ToUInt32(AccountId)));
|
|
}
|
|
protected async void DeleteAccount()
|
|
{
|
|
await AccountService.DeleteAccountAsync(account);
|
|
NavigationManager.NavigateTo("Accounts/Index");
|
|
}
|
|
void Cancel()
|
|
{
|
|
NavigationManager.NavigateTo("Accounts/Index");
|
|
}
|
|
} |