// // GET: /Employee/Edit/5 public ActionResult Edit(int id) { var repository = new EmployeeRepository(); var employee = repository.FindById(id); return View(employee); }
public ActionResult Edit(int id, string name, DateTime hireDate) { var repository = new EmployeeRepository(); var employee = repository.FindById(id); if (ModelState.IsValid) { employee.Name = name; employee.HireDate = hireDate; UpdateModel(employee); repository.Save(employee); return RedirectToAction("Index"); } return View(employee); }
// // GET: /Employee/ public ActionResult Index() { var repository = new EmployeeRepository(); var employees = repository.GetAll(); return View(employees); }