public async Task <IActionResult> Create([Bind("CourseID,CourseName,StartDate,EndDate,CourseDuration")] Course course) { if (ModelState.IsValid) { _context.Add(course); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(course)); }
public async Task <IActionResult> Create([Bind("StudentID,StudentFname,StudentLname,StudentDoB,StudentAddress")] Student student) { if (ModelState.IsValid) { _context.Add(student); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(student)); }
public async Task <IActionResult> Create([Bind("ID,StudentID,CourseID")] Enrol enrol) { if (ModelState.IsValid) { _context.Add(enrol); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CourseID"] = new SelectList(_context.Course, "CourseID", "CourseID", enrol.CourseID); ViewData["StudentID"] = new SelectList(_context.Student, "StudentID", "StudentID", enrol.StudentID); return(View(enrol)); }