65 lines
1.6 KiB
C#
65 lines
1.6 KiB
C#
using MagMan.Core.Services;
|
|
using MagMan.Data.Admin.DbModels;
|
|
using MagMan.Data.Admin.Services;
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
namespace MagMan.UI.Components
|
|
{
|
|
public partial class CmpSelCliente
|
|
{
|
|
#region Protected Properties
|
|
|
|
[Inject]
|
|
protected MessageService AppMService { get; set; } = null!;
|
|
|
|
protected int CustomerID
|
|
{
|
|
get => customerID;
|
|
set
|
|
{
|
|
if (customerID != value)
|
|
{
|
|
customerID = value;
|
|
InvokeAsync(() => AppMService.ClientIdSet(value));
|
|
AppMService.CustomerID = value;
|
|
InvokeAsync(StateHasChanged);
|
|
}
|
|
}
|
|
}
|
|
|
|
[Inject]
|
|
protected MTAdminService MTService { get; set; } = null!;
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
|
{
|
|
if (firstRender || CustomerID < 0)
|
|
{
|
|
CustomerID = await AppMService.ClientIdGet();
|
|
}
|
|
}
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
await ReloadData();
|
|
}
|
|
|
|
protected async Task ReloadData()
|
|
{
|
|
CustomersList = await MTService.CustomerGetAll();
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
private int customerID = -1;
|
|
|
|
private List<CustomerModel>? CustomersList = null;
|
|
|
|
#endregion Private Fields
|
|
}
|
|
} |