68 lines
1.4 KiB
C#
68 lines
1.4 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using SHERPA.BBM.CORE.DbModels;
|
|
using SHERPA.BBM.UI.Data;
|
|
|
|
namespace SHERPA.BBM.UI.Components
|
|
{
|
|
public partial class CustomersEditor
|
|
{
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public CustomersModel currItem
|
|
{
|
|
get
|
|
{
|
|
return _currItem;
|
|
}
|
|
|
|
set
|
|
{
|
|
_currItem = value;
|
|
}
|
|
}
|
|
|
|
[Parameter]
|
|
public EventCallback<int> DataReset { get; set; }
|
|
|
|
[Parameter]
|
|
public EventCallback<int> DataUpdated { get; set; }
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Protected Fields
|
|
|
|
protected CustomersModel _currItem = new CustomersModel();
|
|
|
|
#endregion Protected Fields
|
|
|
|
#region Protected Properties
|
|
|
|
[Inject]
|
|
protected BBM_EFService BBMService { get; set; } = null!;
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Private Methods
|
|
|
|
private async Task cancelUpdate()
|
|
{
|
|
await DataReset.InvokeAsync(0);
|
|
}
|
|
|
|
private async Task saveUpdate()
|
|
{
|
|
if (_currItem != null)
|
|
{
|
|
await BBMService.CustomerUpdate(_currItem);
|
|
await DataUpdated.InvokeAsync(1);
|
|
}
|
|
else
|
|
{
|
|
Console.WriteLine("Counter null!");
|
|
}
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |