public async Task <IActionResult> Edit(int id, [Bind("GradeId,GradeName")] 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("AmbionId,AmbionName")] Ambion ambion) { if (id != ambion.AmbionId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(ambion); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AmbionExists(ambion.AmbionId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(ambion)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,StudentName,CurrentGradeID,CurrentAmbionID")] 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))); } ViewData["CurrentGradeID"] = new SelectList(_context.Set <Grade>(), "GradeId", "GradeId", student.CurrentGradeID); ViewData["CurrentAmbionID"] = new SelectList(_context.Set <Ambion>(), "AmbionId", "AmbionId", student.CurrentAmbionID); return(View(student)); }