@using TIAM.Entities.Products @using TIAM.Entities.ServiceProviders @using TIAM.Entities.Transfers @using TIAM.Entities.Drivers @using TIAM.Entities.Users @using TIAM.Models.Dtos.Users @using TIAMWebApp.Shared.Application.Interfaces @using TIAMWebApp.Shared.Application.Utility @using AyCode.Services.Loggers @using TIAM.Core.Loggers @inject IServiceProviderDataService serviceProviderDataService @inject IUserDataService userDataService @inject IEnumerable LogWriters
Profile
@code { [Parameter] public bool KeyboardNavigationEnabled { get; set; } [Parameter] public object ProfileContext { get; set; } [Parameter] public string ContextIdType { get; set; } List _detailGridData; List _availableProfiles; ILogger _logger; protected override async Task OnInitializedAsync() { _logger = new LoggerClient(LogWriters.ToArray()); if(ContextIdType == null) { //get all profiles from DB } else { switch (ContextIdType) { case ("user"): //get profile for user UserModelDto resultData = (UserModelDto)ProfileContext; _detailGridData.Add(resultData.UserDto.Profile); break; case ("product"): //get profile for product //var resultData2 = await serviceProviderDataService.GetProductById(ContextId); //todo Product resultData2 = (Product)ProfileContext; _detailGridData.Add(resultData2.Profile); break; case ("company"): //get profile for company Company resultData3 = (Company)ProfileContext; _detailGridData.Add(resultData3.Profile); break; } } _logger.Info($"DetailGridData: {_detailGridData.Count}"); } void CustomizeEditModel(GridCustomizeEditModelEventArgs e) { if (!e.IsNew) return; //editmodel customize } async Task EditModelSaving(GridEditModelSavingEventArgs e) { if (e.IsNew) //add new orderData to orderData array _logger.Info("Data added"); else _logger.Info("Data updated"); await UpdateDataAsync(); } async Task DataItemDeleting(GridDataItemDeletingEventArgs e) { _logger.Info("orderData deleted"); } async Task UpdateDataAsync() { //refresh grid _logger.Info("orderData grid refreshed"); StateHasChanged(); } }