public async Task <IActionResult> Edit(int id, [Bind("ID,LastName,FirstName,StartingDate")] Supervisor supervisor) { if (id != supervisor.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(supervisor); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SupervisorExists(supervisor.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(supervisor)); }
public async Task <IActionResult> Edit(int id, [Bind("DepartmentID,Title,Budget")] Department department) { if (id != department.DepartmentID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(department); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DepartmentExists(department.DepartmentID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(department)); }
public async Task <IActionResult> Edit(int id, [Bind("EId,EName,EDesig,EDOJ")] Emp emp) { if (id != emp.EId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(emp); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmpExists(emp.EId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(emp)); }
public async Task <IActionResult> Edit(int id, [Bind("ContractID,DepartmentID,StandardID,SupervisorID")] Contract contract) { if (id != contract.ContractID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(contract); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ContractExists(contract.ContractID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["DepartmentID"] = new SelectList(_context.Departments, "DepartmentID", "Title", contract.DepartmentID); ViewData["StandardID"] = new SelectList(_context.Standards, "ID", "FirstName", contract.StandardID); ViewData["SupervisorID"] = new SelectList(_context.Supervisors, "ID", "FirstName", contract.SupervisorID); return(View(contract)); }