50 lines
1.2 KiB
C#
50 lines
1.2 KiB
C#
using MagMan.Data.Tenant.DbModels;
|
|
using MagMan.Data.Tenant.Services;
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
namespace MagMan.UI.Components
|
|
{
|
|
public partial class ItemEdit
|
|
{
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public RawItemModel? CurrRecord { get; set; } = null;
|
|
|
|
[Parameter]
|
|
public int KeyNum { get; set; } = 0;
|
|
[Parameter]
|
|
public EventCallback<bool> EC_update { get; set; }
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Protected Properties
|
|
|
|
[Inject]
|
|
protected TenantService TService { get; set; } = null!;
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected async Task DoSave()
|
|
{
|
|
bool fatto = false;
|
|
await Task.Delay(1);
|
|
if (CurrRecord != null)
|
|
{
|
|
fatto = await TService.ItemUpdate(KeyNum, CurrRecord);
|
|
}
|
|
if (fatto)
|
|
{
|
|
await EC_update.InvokeAsync(true);
|
|
}
|
|
}
|
|
protected async Task DoCancel()
|
|
{
|
|
await EC_update.InvokeAsync(true);
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
}
|
|
} |