Files
magman/MagMan.UI/Components/MaterialEdit.razor.cs
T
Samuele Locatelli 9bb42101ea Fix editing materiali
2024-02-08 10:23:06 +01:00

59 lines
1.4 KiB
C#

// Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this
// file to you under the MIT license.
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 MaterialEdit
{
#region Public Properties
[Parameter]
public MaterialModel? CurrRecord { get; set; } = null;
[Parameter]
public EventCallback<bool> EC_update { get; set; }
[Parameter]
public int MatType { get; set; } = 0;
[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 async Task DoSave()
{
bool fatto = false;
await Task.Delay(1);
if (CurrRecord != null)
{
fatto = await TService.MaterialUpdate(KeyNum, CurrRecord);
}
if (fatto)
{
await EC_update.InvokeAsync(true);
}
}
#endregion Protected Methods
}
}