mirror of
https://github.com/markjprice/cs11dotnet7.git
synced 2025-12-06 05:32:03 +01:00
32 lines
663 B
Plaintext
32 lines
663 B
Plaintext
@page "/editcustomer/{customerid}"
|
|
@inject INorthwindService service
|
|
@inject NavigationManager navigation
|
|
|
|
<h3>Edit Customer</h3>
|
|
|
|
<CustomerDetail ButtonText="Update"
|
|
Customer="@customer"
|
|
OnValidSubmit="@Update" />
|
|
|
|
@code {
|
|
[Parameter]
|
|
public string CustomerId { get; set; } = null!;
|
|
|
|
private Customer? customer = new();
|
|
|
|
protected async override Task OnParametersSetAsync()
|
|
{
|
|
customer = await service.GetCustomerAsync(CustomerId);
|
|
}
|
|
|
|
private async Task Update()
|
|
{
|
|
if (customer is not null)
|
|
{
|
|
await service.UpdateCustomerAsync(customer);
|
|
}
|
|
|
|
navigation.NavigateTo("customers");
|
|
}
|
|
}
|