public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Type")] LabWork labwork) { if (id != labwork.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(labwork); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LabWorkExists(labwork.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(labwork)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,LabWorkID,StudentID")] StudentLabWork studentLabWork) { if (id != studentLabWork.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(studentLabWork); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StudentLabWorkExists(studentLabWork.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["LabWorkID"] = new SelectList(_context.LabWorks, "ID", "Name", studentLabWork.LabWorkID); ViewData["StudentID"] = new SelectList(_context.Student, "ID", "FullName", studentLabWork.StudentID); return(View(studentLabWork)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Group,Email")] 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))); } return(View(student)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,LabWorkID,TeacherID,Name,Date,Place")] Passing passing) { if (id != passing.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(passing); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PassingExists(passing.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["TeacherID"] = new SelectList(_context.Teachers, "ID", "Address", passing.TeacherID); ViewData["LabWorkID"] = new SelectList(_context.LabWorks, "ID", "Name", passing.LabWorkID); return(View(passing)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,FullName,Date,Address")] Teacher teacher) { if (id != teacher.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(teacher); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TeacherExists(teacher.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(teacher)); }