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)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Subject subject) { if (id != subject.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(subject); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SubjectExists(subject.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(subject)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,SubjectMark,SubjectName,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)); }