public async Task <IActionResult> Edit(int id, [Bind("ID,name,course")] Students students) { if (id != students.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(students); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StudentsExists(students.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(students)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,StudentName,RegNo,Email,DepartmentName")] Student student) { if (id != student.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(student); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StudentExists(student.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(student)); }