@using GWMS.UI.Components @using GWMS.Data.DatabaseModels @using System.Security.Claims @using Microsoft.AspNetCore.Components.Authorization @using GWMS.UI.Data @using GWMS.Data.DTO @using Microsoft.Extensions.Configuration @inject MessageService AppMService @inject GWMSDataService DataService @inject IConfiguration Configuration
Modifica
@code { private List PlantsList; private List SuppliersList; private List TransportersList; protected UserModel _currItem = new UserModel(); protected int _supplierId { get; set; } = 0; [Parameter] public UserModel currItem { get { return _currItem = null; } set { _currItem = value; } } [Parameter] public EventCallback DataReset { get; set; } [Parameter] public EventCallback DataUpdated { get; set; } [Parameter] public int SupplierId { get { return _supplierId; } set { _supplierId = value; // condiziono visualizzazione... var pUpd = Task.Run(async () => await ReloadAllData()); pUpd.Wait(); } } private async Task saveUpdate() { if (_currItem != null) { DataService.UserUpdate(_currItem); await DataUpdated.InvokeAsync(1); } else { Console.WriteLine("User null!"); } } private async Task cancelUpdate() { await DataReset.InvokeAsync(0); } protected override async Task OnInitializedAsync() { await ReloadAllData(); } protected async Task ReloadAllData() { PlantsList = await DataService.PlantsGetAll(); SuppliersList = await DataService.SuppliersGetAll(); TransportersList = await DataService.TransportersGetAll(); } }