コード例 #1
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

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

            if (Student == null)
            {
                return(NotFound());
            }
            ViewData["CourseID"] = new SelectList(_context.Set <Course>(), "ID", "CourseName");
            return(Page());
        }
コード例 #2
0
 public IActionResult OnGet()
 {
     ViewData["CourseID"] = new SelectList(_context.Set <Course>(), "ID", "CourseName");
     return(Page());
 }