Skip to content

Commit

Permalink
update fetch data
Browse files Browse the repository at this point in the history
  • Loading branch information
Ali-YousefiTelori committed Nov 18, 2023
1 parent e878f04 commit 966658e
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<Authors>EasyMicroservices</Authors>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>0.0.0.10</Version>
<Version>0.0.0.11</Version>
<Description>ordering UI compoents.</Description>
<Copyright>[email protected]</Copyright>
<PackageTags>component,microcomponent,ui,core,order,ordering</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
return viewModel;
}
}
CountingUnitType CountingUnitType = CountingUnitType.Number;
protected override Task OnInitializedAsync()
{
viewModel.BindPropertyChanged(StateHasChanged);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@

protected override Task OnInitializedAsync()
{
_ = viewModel.LoadConfig();
viewModel.BindPropertyChanged(StateHasChanged);
return base.OnInitializedAsync();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
</MudText>
</TitleContent>
<DialogContent>
<AddOrUpdateProduct @ref="addOrUpdateProductView" />
<AddOrUpdateProduct @ref="AddOrUpdateProductView" />
</DialogContent>
</MudDialog>
<MudDialog Class="@DialogClass" @ref="deleteDialog" @bind-IsVisible="IsShowDeleteDialog">
Expand Down Expand Up @@ -89,7 +89,7 @@
}
</style>
@code {
AddOrUpdateProduct addOrUpdateProductView;
AddOrUpdateProduct AddOrUpdateProductView { get; set; }
MudDialog deleteDialog;
DialogOptions DialogOptions = new DialogOptions()
{
Expand All @@ -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<GridData<ProductContract>> LoadGridData(GridState<ProductContract> state)
Expand Down Expand Up @@ -136,21 +136,21 @@
{
_AddOrUpdateTitle = "Update Product";
_AddOrUpdatedMessage = "Product updated.";
addOrUpdateProductView.ViewModel.UpdateProductContract = productContract;
AddOrUpdateProductView.ViewModel.UpdateProductContract = productContract;
ShowAddOrUpdateDialog();
}

void ShowAddDialog()
{
_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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<Authors>EasyMicroservices</Authors>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>0.0.0.5</Version>
<Version>0.0.0.11</Version>
<Description>ordering view model.</Description>
<Copyright>[email protected]</Copyright>
<PackageTags>mvvm,viewmodel,viewmodels,modelviewviewmodel,ui,core,order,ordering</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public AddOrUpdateProductViewModel(ProductClient productClient, CountingUnitClie
_countingUnitClient = countingUnitClient;
SaveCommand = new TaskRelayCommand(this, Save);
Clear();
_ = Load();
}

public TaskRelayCommand SaveCommand { get; set; }
Expand Down Expand Up @@ -156,7 +155,7 @@ List<LanguageDataContract> GetNames()
};
}

async Task Load()
public async Task LoadConfig()
{
var items = await _countingUnitClient.GetAllByLanguageAsync(new GetByLanguageRequestContract()
{
Expand All @@ -170,6 +169,7 @@ public void Clear()
Name = "";
PriceAmount = 0;
UpdateProductContract = default;
CountingUnits = null;
}
}
}

0 comments on commit 966658e

Please sign in to comment.