52 lines
988 B
C#
52 lines
988 B
C#
using Microsoft.AspNetCore.Components;
|
|
|
|
namespace Duempelkas.App.Components.Dialogs;
|
|
|
|
public partial class EditNameDialog
|
|
{
|
|
#region Parameters
|
|
|
|
[Parameter]
|
|
public string CurrentName { get; set; } = string.Empty;
|
|
|
|
[Parameter]
|
|
public string DialogTitle { get; set; } = "Kontoname bearbeiten";
|
|
|
|
[Parameter]
|
|
public string NameLabel { get; set; } = "Kontoname";
|
|
|
|
[Parameter]
|
|
public EventCallback<string> OnSave { get; set; }
|
|
|
|
[Parameter]
|
|
public EventCallback OnCancel { get; set; }
|
|
|
|
#endregion
|
|
|
|
#region Fields
|
|
|
|
private string name = string.Empty;
|
|
|
|
#endregion
|
|
|
|
#region Lifecycle
|
|
|
|
protected override void OnParametersSet() => name = CurrentName;
|
|
|
|
#endregion
|
|
|
|
#region Actions
|
|
|
|
private async Task Save()
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(name))
|
|
{
|
|
await OnSave.InvokeAsync(name.Trim());
|
|
}
|
|
}
|
|
|
|
private async Task Cancel() => await OnCancel.InvokeAsync();
|
|
|
|
#endregion
|
|
}
|