public async Task <IActionResult> Edit(string id, [Bind("StudentId,SchoolClassId")] SchoolClassStudent schoolClassStudent) { if (id != schoolClassStudent.StudentId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(schoolClassStudent); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SchoolClassStudentExists(schoolClassStudent.StudentId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["SchoolClassId"] = new SelectList(_context.SchoolClasses, "Id", "ClassName", schoolClassStudent.SchoolClassId); return(View(schoolClassStudent)); }
public async Task <IActionResult> Edit(Guid id, [Bind("Id,ClassName,TeacherId")] SchoolClass schoolClass) { if (id != schoolClass.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(schoolClass); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SchoolClassExists(schoolClass.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(schoolClass)); }