| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 
 | using Microsoft.AspNetCore.Components;using StudentManagement.Models;
 
 namespace StudentManagement.Web.Pages;
 
 public class StudentListListBase: ComponentBase
 {
 public IEnumerable<Student> Students { get; set; }
 
 
 protected override Task OnInitializedAsync()
 {
 LoadStudents();
 return base.OnInitializedAsync();
 }
 
 private void LoadStudents()
 {
 var s1 = new Student()
 {
 StudentId = 1,
 FirstName = "John",
 LastName = "Hastings",
 Email = "David@qq.com",
 DateOfBrith = new DateTime(1980, 10, 5),
 Gender = Gender.Male,
 StudentClass = new StudentClass {ClassId = 1, ClassName = "计算机科学"},
 PhotoPath = "images/john.png"
 };
 
 var s2 = new Student()
 {
 StudentId = 2,
 FirstName = "Sam",
 LastName = "Galloway",
 Email = "Sam@qq.com",
 DateOfBrith = new DateTime(1981, 12, 22),
 Gender = Gender.Male,
 StudentClass = new StudentClass { ClassId = 2, ClassName = "软件工程" },
 PhotoPath = "images/sam.jpg"
 };
 
 var s3 = new Student()
 {
 StudentId = 3,
 FirstName = "Mary",
 LastName = "Smith",
 Email = "mary@qq.com",
 DateOfBrith = new DateTime(1979, 11, 11),
 Gender = Gender.Female,
 StudentClass = new StudentClass { ClassId = 3, ClassName = "通信工程" },
 PhotoPath = "images/mary.png"
 };
 
 var s4 = new Student()
 {
 StudentId = 4,
 FirstName = "Sara",
 LastName = "Longway",
 Email = "sara@qq.com",
 DateOfBrith = new DateTime(1982, 9, 23),
 Gender = Gender.Female,
 StudentClass = new StudentClass { ClassId = 3, ClassName = "移动互联网" },
 PhotoPath = "images/sara.png"
 };
 
 Students = new List<Student> {s1, s2, s3, s4};
 }
 }
 
 |