public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Address")] Campus campus) { if (id != campus.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(campus); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CampusExists(campus.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(campus)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,DepartmentId,Name,Gender,Nation,HireDate,PhoneNumber,Email,Academic,OfficeLocation,Password")] Models.Instructor instructor) { if (id != instructor.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(instructor); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!InstructorExists(instructor.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Profile")); } return(RedirectToAction("Profile")); }
public async Task <IActionResult> Edit(int id, [Bind("Id,DepartmentId,Title")] Course course) { if (id != course.Id) { return(NotFound()); } SetViewData(); if (ModelState.IsValid) { try { _context.Update(course); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CourseExists(course.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["DepartmentID"] = new SelectList(_context.Department, "Id", "Name", course.DepartmentId); return(View(course)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Username,Password")] Models.Admin kUAdmin) { if (id != kUAdmin.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(kUAdmin); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!KUAdminExists(kUAdmin.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(kUAdmin)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,CampusId,InstructorId,Name,StartTime")] 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("Index")); } ViewData["InstructorID"] = new SelectList(_context.Instructor, "Id", "Name", department.InstructorId); ViewData["CampusID"] = new SelectList(_context.Campus, "Id", "Name", department.CampusId); return(View(department)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,DepartmentId,Title")] Major major) { if (id != major.Id) { return(NotFound()); } SetViewData(); if (ModelState.IsValid) { try { _context.Update(major); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MajorExists(major.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(major)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,InstructorID,MajorID,StartYear,Order")] Eclass eClass) { SetViewData(); if (id != eClass.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(eClass); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EClassExists(eClass.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["InstructorID"] = new SelectList(_context.Instructor, "Id", "Name", eClass.InstructorId); ViewData["MajorID"] = new SelectList(_context.Major, "Id", "Title", eClass.MajorId); return(View(eClass)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,EclassId,Name,Gender,Nation,EnrollmentDate,PhoneNumber,Email,Password")] Models.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("Details")); } ViewData["EClassID"] = new SelectList(_context.Eclass, "Id", "Id", student.EclassId); return(RedirectToAction("Details")); }