public async void ConfirmDialog_OnDialogClose() { await StoreDataService.DeleteStore(this.SelectedStore.Id); Stores = (await StoreDataService.GetAllStores()).ToList(); ToastService.ShowToast($"Store ''{this.SelectedStore.Name}'' has been deleted!", ToastLevel.Warning); //DisplayStatusAlert("alert-danger", $"Store ''{this.SelectedStore.Name}'' has been deleted!"); await FilterStores(); await ScrollToTop(); }
protected async Task HandleValidSubmit() { if (this.Store.Id == 0) { var newStore = StoreDataService.AddStore(this.Store); } else { await StoreDataService.UpdateStore(this.Store); } }
protected override async Task OnInitializedAsync() { int.TryParse(this.StoreId, out var storeId); this.Store = (await StoreDataService.GetStoreDetails(storeId)); //hardcoded latitude. They should be poulated fromstore address double lat = 50.836025; double longit = 4.370705; MapMarkers = new List <MapHelper.Marker> { new MapHelper.Marker { Description = $"{this.Store.Name}", ShowPopup = false, X = longit, Y = lat } }; }
protected async Task HandleValidSubmit() { if (this.Store.Id > 0) { await StoreDataService.UpdateStore(Store); } else { await StoreDataService.AddStore(Store); } ShowDialog = false; await CloseEventCallback.InvokeAsync(true); StateHasChanged(); }
private async Task FilterStores() { allStores = (await StoreDataService.GetAllStores()).ToList(); int.TryParse(this.CategoryId, out var categoryId); if (categoryId == 0) { this.Stores = allStores; } else { if (allStores != null) { this.Stores = allStores.Where(store => store.CategoryId == categoryId.ToString()).ToList(); } } this.SelectedStore = null; StateHasChanged(); }