@using Microsoft.EntityFrameworkCore @* ToListAsync extension method *@ @page "/customers/{country?}" @inject INorthwindService service

Customers @(string.IsNullOrWhiteSpace(Country) ? "Worldwide" : "in " + Country)

Create New
@if (customers is null) {

Loading...

} else { @foreach (Customer c in customers) { }
Id Company Name Address Phone
@c.CustomerId @c.CompanyName @c.Address
@c.City
@c.PostalCode
@c.Country
@c.Phone
} @code { [Parameter] public string? Country { get; set; } private IEnumerable? customers; protected override async Task OnParametersSetAsync() { if (string.IsNullOrWhiteSpace(Country)) { customers = await service.GetCustomersAsync(); } else { customers = await service.GetCustomersAsync(Country); } } }