public void InsertEmployee(Employee emp) { EmployeeDBModel obj = new EmployeeDBModel(); obj.Employees.Add(emp); obj.SaveChanges(); }
public void DeleteEmployee(int empId) { EmployeeDBModel emp = new EmployeeDBModel(); var e = (from obj in emp.Employees where obj.EmployeeId == empId select obj).First(); emp.Employees.Remove(e); emp.SaveChanges(); }
public void UpdateEmployee(Employee emp) { EmployeeDBModel obj = new EmployeeDBModel(); var c = (from e in obj.Employees where e.EmployeeId == emp.EmployeeId select e).First(); c.EmployeeName = emp.EmployeeName; c.EmployeeSal = emp.EmployeeSal; c.EmployeeAddress = emp.EmployeeAddress; c.Street = emp.Street; c.City = emp.City; c.State = emp.State; obj.SaveChanges(); }