Exemplo n.º 1
0
        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());
        }
Exemplo n.º 2
0
 public IActionResult OnGet()
 {
     ViewData["CourseID"]  = new SelectList(_context.Course, "CourseID", "CourseID");
     ViewData["StudentID"] = new SelectList(_context.Set <Student>(), "ID", "ID");
     return(Page());
 }
Exemplo n.º 3
0
 public GenericRepository(SchoolContext context)
 {
     this.context = context;
     this.dbSet   = context.Set <TEntity>();
 }