public async Task <IActionResult> Create([Bind("CourseId,CourseName")] Courses courses) { if (ModelState.IsValid) { _context.Add(courses); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(courses)); }
public async Task <IActionResult> Create([Bind("TeacherId,Name")] Teachers teachers) { if (ModelState.IsValid) { _context.Add(teachers); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(teachers)); }
public async Task <IActionResult> Create([Bind("UserId,Password,JobTitle")] Users users) { if (ModelState.IsValid) { _context.Add(users); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(users)); }
public async Task <IActionResult> Create([Bind("CourseId,TeacherId,AssignmentDate")] CourseAssignment courseAssignment) { if (ModelState.IsValid) { _context.Add(courseAssignment); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CourseId"] = new SelectList(_context.Courses, "CourseId", "CourseId", courseAssignment.CourseId); ViewData["TeacherId"] = new SelectList(_context.Teachers, "TeacherId", "TeacherId", courseAssignment.TeacherId); return(View(courseAssignment)); }