Exemplo n.º 1
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Student = await _context.Student.FindAsync(id);

            if (Student == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Exemplo n.º 2
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Student = await _context.Student
                      .Include(s => s.Enrollments)
                      .ThenInclude(e => e.Course)
                      .AsNoTracking()
                      .FirstOrDefaultAsync(m => m.ID == id);

            Student = await _context.Student.FirstOrDefaultAsync(m => m.ID == id);

            if (Student == null)
            {
                return(NotFound());
            }
            return(Page());
        }