public async Task <IActionResult> Edit(int id, [Bind("ID,fname,lname,benefits")] Employee employee) { if (id != employee.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(employee); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmployeeExists(employee.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(employee)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,fname,lname,dcode,employeeID")] Dependent dependent) { if (id != dependent.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(dependent); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DependentExists(dependent.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Details), new { ID = dependent.ID })); } ViewData["employeeID"] = new SelectList(_context.Employee, "ID", "ID", dependent.employeeID); return(View(dependent)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,fname,lname,StartDate,benefit_enrolled,Dependents,YearsEmployed")] GetEmployeeSummary_Result getEmployeeSummary_Result) { if (id != getEmployeeSummary_Result.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(getEmployeeSummary_Result); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GetEmployeeSummary_ResultExists(getEmployeeSummary_Result.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(getEmployeeSummary_Result)); }