public void Guardar(Employee employee) { EmployeeContext employeeContext = new EmployeeContext(); employeeContext.Employees.Add(employee); employeeContext.SaveChanges(); }
public ActionResult Edit(Employee employee) { if(ModelState.IsValid) { EmployeeBusinessLayer employeeBusinessLayer = new EmployeeBusinessLayer(); employeeBusinessLayer.SaveEmployee(employee); return RedirectToAction("Prueba"); } return View(); }
public ActionResult Create(Employee employee) { if (ModelState.IsValid) { EmployeeBusinessLayer employeeBusinessLayer = new EmployeeBusinessLayer(); employeeBusinessLayer.Guardar(employee); return RedirectToAction("Prueba"); } return View(); }
public void SaveEmployee(Employee employee) { EmployeeContext employeeContext = new EmployeeContext(); Employee empleado = employeeContext.Employees.First(emp => emp.EmployeeId == employee.EmployeeId); empleado.city = employee.city; empleado.Department = employee.Department; empleado.gender = employee.gender; empleado.name= employee.name; employeeContext.SaveChanges(); }