public async Task <IActionResult> Create([Bind("DepartmentId,DepartmentName")] Department department) { if (ModelState.IsValid) { _context.Add(department); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(department)); }
public async Task <IActionResult> Create([Bind("StudentId,StudentFirstName,StudentLastName,StudentEnrollment,StudentPhone")] Student student) { if (ModelState.IsValid) { _context.Add(student); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(student)); }
public async Task <IActionResult> Create([Bind("InstructorId,InstructorFirstName,InstructorLastName,InstructorPhone,InstructorHireDepartment")] Instructor instructor) { if (ModelState.IsValid) { _context.Add(instructor); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(instructor)); }
public async Task <IActionResult> Create([Bind("TermId,TermName,TermStartDate,TermEndDate,TermYear,TermSeason")] StudyTerm studyTerm) { if (ModelState.IsValid) { _context.Add(studyTerm); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(studyTerm)); }
public async Task <IActionResult> Create([Bind("CourseId,CourseName,DepartmentId")] Courses courses) { if (ModelState.IsValid) { _context.Add(courses); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["DepartmentId"] = new SelectList(_context.Department, "DepartmentId", "DepartmentId", courses.DepartmentId); return(View(courses)); }
public async Task <IActionResult> Create([Bind("StudentId,CourseId,TermId")] Registration registration) { if (ModelState.IsValid) { _context.Add(registration); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CourseId"] = new SelectList(_context.Courses, "CourseId", "CourseId", registration.CourseId); ViewData["StudentId"] = new SelectList(_context.Student, "StudentId", "StudentId", registration.StudentId); ViewData["TermId"] = new SelectList(_context.StudyTerm, "TermId", "TermId", registration.TermId); return(View(registration)); }
public async Task <IActionResult> Create([Bind("CourseId,InstructorId,TermId")] TeachingAssignment teachingAssignment) { if (ModelState.IsValid) { _context.Add(teachingAssignment); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CourseId"] = new SelectList(_context.Courses, "CourseId", "CourseId", teachingAssignment.CourseId); ViewData["InstructorId"] = new SelectList(_context.Instructor, "InstructorId", "InstructorId", teachingAssignment.InstructorId); ViewData["TermId"] = new SelectList(_context.StudyTerm, "TermId", "TermId", teachingAssignment.TermId); return(View(teachingAssignment)); }