Path: redb/redb.Templates/templates/redb-app/RedbApp.Web/Pages/Products.razor Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb Page: https://redbase.app/src/dev-2026-12-06/redb/redb.Templates/templates/redb-app/RedbApp.Web/Pages/Products.razor ---- @page "/" @inject ApiClient Api @inject Session Session Products

Products

New product
@if (error is not null) {

@error

}

@data.Total product(s)

@foreach (var item in data.Items) { }
NameCategoryPriceIn stock
@item.Name @item.Category @item.Price.ToString("F2") @(item.InStock ? "yes" : "no")
@code { private string? search; private bool inStockOnly; private string sort = "name"; private ProductPage data = new() { Page = 1, PageSize = 10 }; private string? error; private int PageCount => Math.Max(1, (data.Total + data.PageSize - 1) / Math.Max(1, data.PageSize)); protected override Task OnInitializedAsync() => Session.IsSignedIn ? LoadAsync(1) : Task.CompletedTask; private Task ReloadFromFirstPage() => LoadAsync(1); private Task GoToAsync(int page) => LoadAsync(page); private async Task DeleteAsync(long id) { await RunAsync(() => Api.DeleteProductAsync(id)); await LoadAsync(data.Page); } // Search, sorting and paging run in the API, and there in the database. private Task LoadAsync(int page) => RunAsync(async () => data = await Api.ProductsAsync(search, inStockOnly, sort, page)); private async Task RunAsync(Func call) { error = null; try { await call(); } catch (ApiException ex) { error = ex.Message; } } }