Example #1
0
 public void AddEmployee(Employee emp)
 {
     using (KPITEmployeeTestEntities _dbContext = new KPITEmployeeTestEntities())
     {
         _dbContext.Employees.Add(emp);
         _dbContext.SaveChanges();
     }
 }
Example #2
0
 public void AddLocation(Location location)
 {
     using (KPITEmployeeTestEntities _dbContext = new KPITEmployeeTestEntities())
     {
         _dbContext.Locations.Add(location);
         _dbContext.SaveChanges();
     }
 }
Example #3
0
 public void Delete(int id)
 {
     using (KPITEmployeeTestEntities _dbContext = new KPITEmployeeTestEntities())
     {
         Employee emp = _dbContext.Employees.Find(id);
         _dbContext.Employees.Remove(emp);
         _dbContext.SaveChanges();
     }
 }
Example #4
0
 public void Delete(int empId)
 {
     using (KPITEmployeeTestEntities _dbContext = new KPITEmployeeTestEntities())
     {
         Location location = _dbContext.Locations.Where(p => p.EmployeeId == empId).FirstOrDefault();
         _dbContext.Locations.Remove(location);
         _dbContext.SaveChanges();
     }
 }