@using GWMS.UI.Components @using GWMS.Data.DatabaseModels @using System.Security.Claims @using Microsoft.AspNetCore.Components.Authorization @using GWMS.UI.Data @using Microsoft.Extensions.Configuration @inject MessageService AppMService @inject GWMSDataService DataService @inject IConfiguration Configuration
Modifica
@foreach (var item in suppList) { }
@*
*@
Note
@code { private List suppList; protected OrderModel _currItem = new OrderModel(); protected int _supplierId { get; set; } = 0; [Parameter] public OrderModel 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.OrderUpdate(_currItem); await DataUpdated.InvokeAsync(1); } else { Console.WriteLine("Order null!"); } } private async Task cancelUpdate() { await DataReset.InvokeAsync(0); } protected override async Task OnInitializedAsync() { await ReloadAllData(); } protected async Task ReloadAllData() { suppList = await DataService.SuppliersGetAll(); } /// /// Restituisce URL immagine QRCode /// /// Parametro da renderizzare con QRCode /// protected string getImgUrl(object QrValue) { string baseUrl = $"{Configuration["ZCodeUrl"]}/HOME/QR_site/JSON?val="; string payload = "{'baseUrl':'{0}','parameters':['" + $"{QrValue}" + "']}"; string answ = $"{baseUrl}{payload}"; return answ; } }