public async Task <IActionResult> Edit(int id, [Bind("Id,SubjectName,SubjectMark,StudentRollNumber")] Mark mark) { if (id != mark.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(mark); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MarkExists(mark.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["StudentRollNumber"] = new SelectList(_context.Student, "RollNumber", "RollNumber", mark.StudentRollNumber); return(View(mark)); }
public async Task <IActionResult> Edit(string id, [Bind("RollNumber,FirstName,LastName,Email,CreatedAt,UpdatedAt,Status")] Student student) { if (id != student.RollNumber) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(student); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StudentExists(student.RollNumber)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(student)); }