Пример #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();
        }