Files
magman/MagMan.UI/Components/AliasEdit.razor.cs
T
2024-04-04 12:18:19 +02:00

68 lines
1.5 KiB
C#

using MagMan.Data.Admin.DbModels;
using MagMan.Data.Admin.Services;
using MagMan.Data.Tenant.DbModels;
using MagMan.Data.Tenant.Services;
using Microsoft.AspNetCore.Components;
namespace MagMan.UI.Components
{
public partial class AliasEdit
{
#region Public Properties
[Parameter]
public AliasModel? CurrRecord { get; set; } = null;
[Parameter]
public EventCallback<bool> EC_update { get; set; }
[Parameter]
public int KeyNum { get; set; } = 0;
#endregion Public Properties
#region Protected Properties
[Inject]
protected TenantService TService { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
protected async Task DoCancel()
{
await EC_update.InvokeAsync(true);
}
protected string textActive
{
get
{
string answ = "ND";
if (CurrRecord != null)
{
answ = CurrRecord.IsActive ? "Attivo" : "Eliminato";
}
return answ;
}
}
protected async Task DoSave()
{
bool fatto = false;
await Task.Delay(1);
if (CurrRecord != null)
{
fatto = await TService.AliasUpsert(KeyNum, CurrRecord);
}
if (fatto)
{
await EC_update.InvokeAsync(true);
}
}
#endregion Protected Methods
}
}