public async Task <IActionResult> Edit(int id, [Bind("EmployeeNumber,EducationCode,EducationCount")] EmployeeEducationInfo employeeEducationInfo) { if (id != employeeEducationInfo.EmployeeNumber) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(employeeEducationInfo); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmployeeEducationInfoExists(employeeEducationInfo.EmployeeNumber)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["EducationCode"] = new SelectList(_context.EducationField, "EducationCode", "EducationDescription", employeeEducationInfo.EducationCode); ViewData["EmployeeNumber"] = new SelectList(_context.EmployeeDetail, "EmployeeNumber", "Gender", employeeEducationInfo.EmployeeNumber); return(View(employeeEducationInfo)); }
public async Task <IActionResult> Create([Bind("EmployeeNumber,EducationCode,EducationCount")] EmployeeEducationInfo employeeEducationInfo) { if (ModelState.IsValid) { _context.Add(employeeEducationInfo); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["EducationCode"] = new SelectList(_context.EducationField, "EducationCode", "EducationDescription", employeeEducationInfo.EducationCode); ViewData["EmployeeNumber"] = new SelectList(_context.EmployeeDetail, "EmployeeNumber", "Gender", employeeEducationInfo.EmployeeNumber); return(View(employeeEducationInfo)); }