public async Task <IActionResult> Create([Bind("Id,Username,Password")] Login login) { if (ModelState.IsValid) { _context.Add(login); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(login)); }
public async Task <IActionResult> Create([Bind("Id,CourseName,CourseCode,CourseCredits")] Course course) { if (ModelState.IsValid) { _context.Add(course); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(course)); }
public async Task <IActionResult> Create([Bind("Id,StudentName,CourseId")] Student student) { if (ModelState.IsValid) { _context.Add(student); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CourseId"] = new SelectList(_context.Course, "Id", "Id", student.CourseId); return(View(student)); }
public async Task <IActionResult> Create([Bind("Id,Address,PhoneNo,RegisterNo,StudentId")] StudentDetails studentDetails) { if (ModelState.IsValid) { _context.Add(studentDetails); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["StudentId"] = new SelectList(_context.Student, "Id", "Id", studentDetails.StudentId); return(View(studentDetails)); }