Files
2024-08-02 10:38:36 +02:00

72 lines
1.7 KiB
C#

using MagMan.Core.Services;
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 EventCallback<bool> EC_update { get; set; }
[Parameter]
public int KeyNum { get; set; } = 0;
#endregion Public Properties
#region Protected Properties
[Inject]
protected MessageService AppMService { get; set; } = null!;
protected bool IsAcquisto
{
get => !(CurrRecord!.IsRemn);
set => CurrRecord!.IsRemn = !value;
}
[Inject]
protected TenantService TService { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
protected async Task DoCancel()
{
await EC_update.InvokeAsync(true);
}
protected async Task DoSave()
{
bool fatto = false;
await Task.Delay(1);
if (CurrRecord != null)
{
fatto = await TService.ItemUpdate(KeyNum, CurrRecord, userName, true, false);
}
if (fatto)
{
await EC_update.InvokeAsync(true);
}
}
#endregion Protected Methods
#region Private Properties
private string userName
{
get => AppMService.UserName;
set => AppMService.UserName = value;
}
#endregion Private Properties
}
}