public async Task <IActionResult> Edit(int id, [Bind("Id,DeptId,CourseId,StudentId,Status")] Enroll enroll) { if (id != enroll.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(enroll); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EnrollExists(enroll.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(enroll)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,DeptName,DeptCode")] Department department) { if (id != department.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(department); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DepartmentExists(department.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(department)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,RegNo,FullName,Mobile,Address,DeptId")] 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["DeptId"] = new SelectList(_context.Department, "Id", "DeptCode", student.DeptId); return(View(student)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,CourseName,CourseCode,DeptId")] Course course) { if (id != course.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(course); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CourseExists(course.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["DeptId"] = new SelectList(_context.Department, "Id", "DeptCode", course.DeptId); return(View(course)); }