mirror of
https://github.com/markjprice/cs11dotnet7.git
synced 2025-12-06 05:32:03 +01:00
22 lines
421 B
C#
22 lines
421 B
C#
using Microsoft.AspNetCore.Mvc.RazorPages; // PageModel
|
|
using Packt.Shared; // Customer
|
|
|
|
namespace Northwind.Web.Pages;
|
|
|
|
public class CustomersModel : PageModel
|
|
{
|
|
public ILookup<string?, Customer>? CustomersByCountry;
|
|
|
|
private NorthwindContext db;
|
|
|
|
public CustomersModel(NorthwindContext db)
|
|
{
|
|
this.db = db;
|
|
}
|
|
|
|
public void OnGet()
|
|
{
|
|
CustomersByCountry = db.Customers.ToLookup(c => c.Country);
|
|
}
|
|
}
|