public async Task OnSubmitAsync(EditContext context) { if (!context.Validate()) { return; } if (updateMode) { wordService.UpdateWord((WordModel)context.Model); } else { wordService.AddWord((WordModel)context.Model); } if (updateMode) { await JSRuntime.AlertAsync("Successfully updated."); } else { if (await JSRuntime.ConfirmAsync("Successfully added. Do you want to add more?")) { NavigationManager.NavigateTo("editword", true); return; } } NavigationManager.NavigateTo("words", true); }
private async Task OnDeleteCommandAsync(TableCommandButtonArgs args) { if (await JSRuntime.ConfirmAsync("Are you sure?") && wordService.Remove((args.Data as WordModel).Name)) { GetPagedAll(page, filter); } }