@page "/customers/new"
@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
Νέος πελάτης
Νέος πελάτης
Στοιχεία πελάτη
@code {
[SupplyParameterFromForm]
private Customer? model { get; set; }
protected override void OnInitialized() => model ??= new();
private void Back() => NavigationManager.NavigateTo("customers");
private async Task HandleValidSubmit()
{
var success = await CustomerProxy.Save(model);
if (success)
{
ToastService.Notify(new(ToastType.Success, $"Επιτυχής δημιουργία."));
NavigationManager.NavigateTo("customers");
}
else
{
ToastService.Notify(new(ToastType.Danger, $"Αποτυχία δημιουργίας."));
}
}
}