public async Task <IActionResult> Create([Bind("Id,StudentId,FirstName,LastName,EnrollmentDate,CurrentSemestar,AcquiredCredits,EducationLevel")] 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,FirstName,LastName,Degree,AcademicRank,OfficeNumber,HireDate")] Teacher teacher) { if (ModelState.IsValid) { _context.Add(teacher); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(teacher)); }
public async Task <IActionResult> Create([Bind("Id,Title,Credits,Semester,Programme,EducationLevel,FirstTeacherId,SecondTeacherId")] Course course) { if (ModelState.IsValid) { _context.Add(course); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["FirstTeacherId"] = new SelectList(_context.Set <Teacher>(), "Id", "FullName", course.FirstTeacherId); ViewData["SecondTeacherId"] = new SelectList(_context.Set <Teacher>(), "Id", "FullName", course.SecondTeacherId); return(View(course)); }