有没有办法在 ASP.NET 中的用户登录时显示个性化列表

Is there a way to display a personalised list for a user in ASP.NET when they login

我正在为教师和学生创建一个系统,当教师登录系统时,会出现 class 中的成员列表...但是我不知道如何执行此操作。有人对如何解决这个问题有什么建议吗?

由于教师仅限于一个 class,因此教师与 class 之间建立了一对一的关系。

public class Teacher
{
    public int Id {get; set;}
    public Cohort Cohort {get; set;}
    public int CohortId {get; set;}
}

队列或 class 可以有很多学生。

public class Cohort
{
    public int Id {get; set;}
    public int TeacherId {get; set;}
    public Teacher Teacher {get; set;}
    public List<Student> Students{get; set;}
}

学生只能属于一个队列。

public class Student
{
    public int Id {get; set;}
    public Cohort Cohort {get; set;}
    public int CohortId {get; set;}
}

更新 通过以下方式检索老师的学生:

var cohort = _context.Cohorts.FirstOrDefault(c => c.TeacherId == YourTeacherId);
var students = _context.Students.Where(s => s.CohortId == cohort.Id);