public ActionResult Edit(Employees employees) { if (ModelState.IsValid) { _employees.Update(employees); return(RedirectToAction("Index")); } return(View(employees)); }
public int Update(EmployeeModel employee) { var auxCountry = new Country(); if (employee.Country != null) { auxCountry.ID = employee.Country.ID; } var auxShift = new ConvertShift().Convert(employee.CurrentShift); // var employeeUpdate = repoEmployees.Read(employee.ID); var employeeUpdate = new Employee { ID = employee.ID }; // if (employeeUpdate != null) // { employeeUpdate.FirstName = employee.FirstName; employeeUpdate.LastName = employee.LastName; employeeUpdate.Country = auxCountry; employeeUpdate.EntryDate = employee.EntryDate; employeeUpdate.CurrentShift = auxShift; employeeUpdate.ValueByHour = employee.ValueByHour; repoEmployees.Update(employeeUpdate); return(1); // } // return 0; }