예제 #1
0
        public void Guardar(Employee employee)
        {
            EmployeeContext employeeContext = new EmployeeContext();

            employeeContext.Employees.Add(employee);
            employeeContext.SaveChanges();
        }
예제 #2
0
        public ActionResult Edit(Employee employee)
        {
            if(ModelState.IsValid)
            {
                EmployeeBusinessLayer employeeBusinessLayer = new EmployeeBusinessLayer();
                employeeBusinessLayer.SaveEmployee(employee);
                return RedirectToAction("Prueba");

            }
            return View();
        }
예제 #3
0
        public ActionResult Create(Employee employee)
        {
            if (ModelState.IsValid)
            {
                EmployeeBusinessLayer employeeBusinessLayer = new EmployeeBusinessLayer();
                employeeBusinessLayer.Guardar(employee);
                return RedirectToAction("Prueba");
            }

            return View();
        }
예제 #4
0
        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();
        }