public Employee Update(Employee entity) { Employee employee = context.Employees.Find(entity.Id); context.Entry(employee).CurrentValues.SetValues(entity); context.Entry(employee).State = EntityState.Modified; context.SaveChanges(); return employee; }
public ActionResult Create(Employee employee) { if (ModelState.IsValid) { try { var createdEmployee = employeeRepository.Create(employee); // Bootstrap Alert return RedirectToAction("Index"); } catch (Exception ex) { // Handle } } ViewBag.Teams = new SelectList(teamRepository.GetAll(), "Id", "Name"); return View(employee); }
public Employee Update(Employee entity) { session.SaveOrUpdate(entity); var employee = session.Get<Employee>(entity.Id); return employee; }
public Employee Create(Employee entity) { var employeeId = session.Save(entity); Employee employee = session.Get<Employee>(employeeId); return employee; }
public Employee Create(Employee entity) { Employee employee = context.Employees.Add(entity); context.SaveChanges(); return employee; }