public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Enrollment = await _context.Enrollment .Include(e => e.Course) .Include(e => e.Student).FirstOrDefaultAsync(m => m.EnrollmentID == id); if (Enrollment == null) { return(NotFound()); } ViewData["CourseID"] = new SelectList(_context.Course, "CourseID", "CourseID"); ViewData["StudentID"] = new SelectList(_context.Set <Student>(), "ID", "ID"); return(Page()); }
public IActionResult OnGet() { ViewData["CourseID"] = new SelectList(_context.Course, "CourseID", "CourseID"); ViewData["StudentID"] = new SelectList(_context.Set <Student>(), "ID", "ID"); return(Page()); }
public GenericRepository(SchoolContext context) { this.context = context; this.dbSet = context.Set <TEntity>(); }