public Employee InsertAndReturn(Employee employee)
 {
     using (var context = new CodeFirstModels())
     {
         context.Employees.Add(employee);
         context.SaveChanges();
         return employee;
     }
 }
 public int Insert(Employee employee)
 {
     using (var context = new CodeFirstModels())
     {
         context.Employees.Add(employee);
         context.SaveChanges();
         return employee.EmployeeKey;
     }
 }
 public void Delete(int employeeKey)
 {
     using (var context = new CodeFirstModels())
     {
         var employee = context.Employees.Where(e => e.EmployeeKey == employeeKey).First();
         context.Employees.Remove(employee);
         context.SaveChanges();
     }
 }
 public void Update(EmployeeOfficePhone employee)
 {
     using (var context = new CodeFirstModels())
     {
         var entity = context.Employees.Where(e => e.EmployeeKey == employee.EmployeeKey).First();
         entity.FirstName = employee.FirstName;
         entity.LastName = employee.LastName;
         entity.OfficePhone = employee.OfficePhone;
         context.SaveChanges();
     }
 }
 public int Upsert(Employee employee)
 {
     using (var context = new CodeFirstModels())
     {
         if (employee.EmployeeKey == 0)
             context.Entry(employee).State = EntityState.Added;
         else
             context.Entry(employee).State = EntityState.Modified;
         context.SaveChanges();
         return employee.EmployeeKey;
     }
 }
 public void Update(Employee employee)
 {
     using (var context = new CodeFirstModels())
     {
         context.Entry(employee).State = EntityState.Modified;
         context.SaveChanges();
     }
 }