public async Task <IActionResult> Edit(int id, [Bind("GradeId,GradeName,Section")] Grade grade) { if (id != grade.GradeId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(grade); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GradeExists(grade.GradeId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(grade)); }
public async Task <IActionResult> Edit(int id, [Bind("StudentId,StudentName")] Student student) { if (id != student.StudentId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(student); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StudentExists(student.StudentId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(student)); }