public void DeleteEmployee(int id)
 {
     using (var context = new EmployeesEFContext())
     {
         var query = from e in context.Employees
                     where e.Id == id
                     select e;
         Employee emp = query.First();
         context.Employees.Remove(emp);
         context.SaveChanges();
     }
 }
 public void UpdateEmployee(Employee emp)
 {
     using (var context = new EmployeesEFContext())
     {
         var query = from e in context.Employees
                     where e.Id == emp.Id
                     select e;
         foreach (Employee e in query)
         {
             e.Name      = emp.Name;
             e.StartDate = emp.StartDate;
         }
         context.SaveChanges();
     }
 }
 public void AddEmployee(Employee emp)
 {
     using (var context = new EmployeesEFContext())
     {
         //id problem
         var query = context.Employees.OrderByDescending(e => e.Id).FirstOrDefault();
         if (query == null)
         {
             emp.Id = 1;
         }
         else
         {
             emp.Id = query.Id + 1;
         }
         context.Employees.Add(emp);
         context.SaveChanges();
     }
 }