public void getEmployee(int ID) { using(var context = new EntityDBContext()) { context.Employees.Find(ID); } }
public void deleteEmployee(Employee Entities) { using(var context = new EntityDBContext()) { var existingvalue = context.Employees.Find(Entities.ID); context.Employees.Remove(existingvalue); context.SaveChanges(); } }
public void updateEmployee(Employee Entities) { using(var context = new EntityDBContext()) { var updating = context.Employees.Attach(Entities); var matchingWithExistingValues = context.Entry<Employee>(updating); matchingWithExistingValues.State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); } }
public List<Employee> ListEmployee() { using (var context = new EntityDBContext()) { return context.Employees.ToList(); } }
public void addEmployee(Employee Entities) { using(var context = new EntityDBContext()) { var adding = context.Employees.Add(Entities); context.SaveChanges();} }