@page "/" @using SqliteWasmHelper @using Account_SQLite.Data @using Microsoft.EntityFrameworkCore @inject ISqliteWasmDbContextFactory Factory Account_SQLite

Accounts

Type some account:

  @if (@busy) {
💾 Scanning a floppy disk...
} else { if (accounts.Length < 1) {

I see no-account.

} else { } } Download backup: @code { private bool busy; private BackupLink bl = null!; private string newAccount = string.Empty; private Account[] accounts = Array.Empty(); protected override async Task OnInitializedAsync() { await RefreshUiAsync(); await base.OnInitializedAsync(); } private async Task RefreshUiAsync() { using var ctx = await Factory.CreateDbContextAsync(); busy = true; accounts = await ctx.Accounts.ToArrayAsync(); await bl.RefreshAsync(); busy = false; StateHasChanged(); } private async Task AddAccountAsync() { if (!string.IsNullOrWhiteSpace(newAccount)) { using var ctx = await Factory.CreateDbContextAsync(); ctx.Accounts.Add(new Account { Name = newAccount }); busy = true; await ctx.SaveChangesAsync(); newAccount = string.Empty; busy = false; await RefreshUiAsync(); } } }