@page "/customers/edit/{id}"
@rendermode InteractiveAuto
@attribute [StreamRendering]
@using BlazorApp.Client.Interfaces
@using BlazorApp.Shared.Models
@using BlazorApp.Shared.Queries
@using BlazorApp.Client.Proxies
@using BlazorBootstrap
@inject ToastService ToastService
@inject ICustomerProxy CustomerProxy
@inject NavigationManager NavigationManager
Επεξεργασία πελάτη
Επεξεργασία πελάτη
Στοιχεία πελάτη
@if (model == null)
{
Loading...
}
else
{
}
@code {
[Parameter]
public string id { get; set; }
[SupplyParameterFromForm]
private Customer? model { get; set; }
private void Back() => NavigationManager.NavigateTo("customers");
protected override async Task OnInitializedAsync()
{
model = await CustomerProxy.Get(id);
}
private async Task HandleValidSubmit()
{
var success = await CustomerProxy.Update(model);
if (success)
{
ToastService.Notify(new(ToastType.Success, $"Επιτυχής ενημέρωση."));
NavigationManager.NavigateTo("customers");
}
else
{
ToastService.Notify(new(ToastType.Danger, $"Αποτυχία ενημέρωσης."));
}
}
}