public ViewResult Detail(int id) { //var model = new HomePageViewModel(); SQLEmployeeData sqlData = new SQLEmployeeData(_context); Employee employee = sqlData.GetEmployee(id); return(View(employee)); }
public IActionResult Edit(int id, EmployeeEditViewModel input) { SQLEmployeeData sqlData = new SQLEmployeeData(_context); var employee = sqlData.GetEmployee(id); if (employee != null && ModelState.IsValid) { employee.Name = input.Name; _context.SaveChanges(); return(RedirectToAction("Detail", new { id = employee.ID })); } return(View(employee)); }
public IActionResult Edit(int id) { //var model = new HomePageViewModel(); SQLEmployeeData sqlData = new SQLEmployeeData(_context); Employee employee = sqlData.GetEmployee(id); if (employee == null) { return(RedirectToAction("Index")); } return(View(employee)); }