From 966658e599f92637e57e13038d514d27c363d0c3 Mon Sep 17 00:00:00 2001 From: Ali Yousefi Date: Sat, 18 Nov 2023 23:35:43 +0330 Subject: [PATCH] update fetch data --- .../EasyMicroservices.UI.Ordering.Blazor.csproj | 2 +- .../CountingUnits/AddOrUpdateCountingUnit.razor | 1 - .../Pages/Products/AddOrUpdateProduct.razor | 1 + .../Pages/Products/FilterProductsList.razor | 14 +++++++------- ...EasyMicroservices.UI.Ordering.ViewModels.csproj | 2 +- .../Products/AddOrUpdateProductViewModel.cs | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/CSharp/Blazor/EasyMicroservices.UI.Ordering.Blazor/EasyMicroservices.UI.Ordering.Blazor.csproj b/src/CSharp/Blazor/EasyMicroservices.UI.Ordering.Blazor/EasyMicroservices.UI.Ordering.Blazor.csproj index 4576e13..431c447 100644 --- a/src/CSharp/Blazor/EasyMicroservices.UI.Ordering.Blazor/EasyMicroservices.UI.Ordering.Blazor.csproj +++ b/src/CSharp/Blazor/EasyMicroservices.UI.Ordering.Blazor/EasyMicroservices.UI.Ordering.Blazor.csproj @@ -4,7 +4,7 @@ net6.0;net7.0 EasyMicroservices true - 0.0.0.10 + 0.0.0.11 ordering UI compoents. EasyMicroservices@gmail.com component,microcomponent,ui,core,order,ordering diff --git a/src/CSharp/Blazor/EasyMicroservices.UI.Ordering.Blazor/Pages/CountingUnits/AddOrUpdateCountingUnit.razor b/src/CSharp/Blazor/EasyMicroservices.UI.Ordering.Blazor/Pages/CountingUnits/AddOrUpdateCountingUnit.razor index 398696a..93b473a 100644 --- a/src/CSharp/Blazor/EasyMicroservices.UI.Ordering.Blazor/Pages/CountingUnits/AddOrUpdateCountingUnit.razor +++ b/src/CSharp/Blazor/EasyMicroservices.UI.Ordering.Blazor/Pages/CountingUnits/AddOrUpdateCountingUnit.razor @@ -31,7 +31,6 @@ return viewModel; } } - CountingUnitType CountingUnitType = CountingUnitType.Number; protected override Task OnInitializedAsync() { viewModel.BindPropertyChanged(StateHasChanged); diff --git a/src/CSharp/Blazor/EasyMicroservices.UI.Ordering.Blazor/Pages/Products/AddOrUpdateProduct.razor b/src/CSharp/Blazor/EasyMicroservices.UI.Ordering.Blazor/Pages/Products/AddOrUpdateProduct.razor index 92cff05..917be5c 100644 --- a/src/CSharp/Blazor/EasyMicroservices.UI.Ordering.Blazor/Pages/Products/AddOrUpdateProduct.razor +++ b/src/CSharp/Blazor/EasyMicroservices.UI.Ordering.Blazor/Pages/Products/AddOrUpdateProduct.razor @@ -44,6 +44,7 @@ protected override Task OnInitializedAsync() { + _ = viewModel.LoadConfig(); viewModel.BindPropertyChanged(StateHasChanged); return base.OnInitializedAsync(); } diff --git a/src/CSharp/Blazor/EasyMicroservices.UI.Ordering.Blazor/Pages/Products/FilterProductsList.razor b/src/CSharp/Blazor/EasyMicroservices.UI.Ordering.Blazor/Pages/Products/FilterProductsList.razor index 4c8a833..86f1309 100644 --- a/src/CSharp/Blazor/EasyMicroservices.UI.Ordering.Blazor/Pages/Products/FilterProductsList.razor +++ b/src/CSharp/Blazor/EasyMicroservices.UI.Ordering.Blazor/Pages/Products/FilterProductsList.razor @@ -53,7 +53,7 @@ - + @@ -89,7 +89,7 @@ } @code { - AddOrUpdateProduct addOrUpdateProductView; + AddOrUpdateProduct AddOrUpdateProductView { get; set; } MudDialog deleteDialog; DialogOptions DialogOptions = new DialogOptions() { @@ -104,10 +104,10 @@ bool IsShowEditDialog = true; bool IsShowDeleteDialog = true; - protected override Task OnInitializedAsync() + protected override async Task OnInitializedAsync() { viewModel.BindPropertyChanged(StateHasChanged); - return base.OnInitializedAsync(); + await base.OnInitializedAsync(); } private async Task> LoadGridData(GridState state) @@ -136,7 +136,7 @@ { _AddOrUpdateTitle = "Update Product"; _AddOrUpdatedMessage = "Product updated."; - addOrUpdateProductView.ViewModel.UpdateProductContract = productContract; + AddOrUpdateProductView.ViewModel.UpdateProductContract = productContract; ShowAddOrUpdateDialog(); } @@ -144,13 +144,13 @@ { _AddOrUpdateTitle = "Add Product"; _AddOrUpdatedMessage = "Product added."; - addOrUpdateProductView.ViewModel.Clear(); + AddOrUpdateProductView.ViewModel.Clear(); ShowAddOrUpdateDialog(); } void ShowAddOrUpdateDialog() { - addOrUpdateProductView.ViewModel.OnSuccess = () => + AddOrUpdateProductView.ViewModel.OnSuccess = () => { IsShowEditDialog = false; viewModel.SearchCommand.Execute(null); diff --git a/src/CSharp/Cores/EasyMicroservices.UI.Ordering.ViewModels/EasyMicroservices.UI.Ordering.ViewModels.csproj b/src/CSharp/Cores/EasyMicroservices.UI.Ordering.ViewModels/EasyMicroservices.UI.Ordering.ViewModels.csproj index a6c5a66..94c20fc 100644 --- a/src/CSharp/Cores/EasyMicroservices.UI.Ordering.ViewModels/EasyMicroservices.UI.Ordering.ViewModels.csproj +++ b/src/CSharp/Cores/EasyMicroservices.UI.Ordering.ViewModels/EasyMicroservices.UI.Ordering.ViewModels.csproj @@ -4,7 +4,7 @@ net6.0;net7.0 EasyMicroservices true - 0.0.0.5 + 0.0.0.11 ordering view model. EasyMicroservices@gmail.com mvvm,viewmodel,viewmodels,modelviewviewmodel,ui,core,order,ordering diff --git a/src/CSharp/Cores/EasyMicroservices.UI.Ordering.ViewModels/ViewModels/Products/AddOrUpdateProductViewModel.cs b/src/CSharp/Cores/EasyMicroservices.UI.Ordering.ViewModels/ViewModels/Products/AddOrUpdateProductViewModel.cs index 5a4659f..8f0b9c8 100644 --- a/src/CSharp/Cores/EasyMicroservices.UI.Ordering.ViewModels/ViewModels/Products/AddOrUpdateProductViewModel.cs +++ b/src/CSharp/Cores/EasyMicroservices.UI.Ordering.ViewModels/ViewModels/Products/AddOrUpdateProductViewModel.cs @@ -13,7 +13,6 @@ public AddOrUpdateProductViewModel(ProductClient productClient, CountingUnitClie _countingUnitClient = countingUnitClient; SaveCommand = new TaskRelayCommand(this, Save); Clear(); - _ = Load(); } public TaskRelayCommand SaveCommand { get; set; } @@ -156,7 +155,7 @@ List GetNames() }; } - async Task Load() + public async Task LoadConfig() { var items = await _countingUnitClient.GetAllByLanguageAsync(new GetByLanguageRequestContract() { @@ -170,6 +169,7 @@ public void Clear() Name = ""; PriceAmount = 0; UpdateProductContract = default; + CountingUnits = null; } } }