mirror of
https://github.com/markjprice/cs11dotnet7.git
synced 2026-01-07 08:39:58 +01:00
25 lines
554 B
C#
25 lines
554 B
C#
using Microsoft.AspNetCore.Mvc.RazorPages; // PageModel
|
|
using Packt.Shared; // Employee, NorthwindContext
|
|
|
|
namespace PacktFeatures.Pages;
|
|
|
|
public class EmployeesPageModel : PageModel
|
|
{
|
|
private NorthwindContext db;
|
|
|
|
public EmployeesPageModel(NorthwindContext injectedContext)
|
|
{
|
|
db = injectedContext;
|
|
}
|
|
|
|
public Employee[] Employees { get; set; } = null!;
|
|
|
|
public void OnGet()
|
|
{
|
|
ViewData["Title"] = "Northwind B2B - Employees";
|
|
|
|
Employees = db.Employees.OrderBy(e => e.LastName)
|
|
.ThenBy(e => e.FirstName).ToArray();
|
|
}
|
|
}
|