//Prepares the enter results form. public IActionResult OnGet() { ViewData["CourseId"] = new SelectList(_context.Course, "Id", "CourseSerialId"); ViewData["StudentId"] = new SelectList(_context.Set <Student>(), "Id", "StudentSerialId"); ViewData["Grade"] = new SelectList(Enum.GetValues(typeof(Grade))); return(Page()); }
//Returns the enrollment with the lamda query to edit. public IActionResult OnGet(int?id) { if (id == null) { return(NotFound()); } Enrollment = _context.Enrollment .Include(e => e.Course) .Include(e => e.Student).FirstOrDefault(m => m.Id == id); if (Enrollment == null) { return(NotFound()); } ViewData["CourseId"] = new SelectList(_context.Course, "Id", "CourseSerialId"); ViewData["StudentId"] = new SelectList(_context.Set <Student>(), "Id", "StudentSerialId"); ViewData["Semester"] = new SelectList(Enum.GetValues(typeof(Semester)), Enrollment.Semester); return(Page()); }