public void InsertEmployee(Employee emp) { EmployeeDBModel obj = new EmployeeDBModel(); obj.Employees.Add(emp); obj.SaveChanges(); }
public IEnumerable <Employee> GetEmployees() { List <Employee> emp = new List <Employee>(); EmployeeDBModel obj = new EmployeeDBModel(); emp = obj.Employees.ToList(); return(emp); }
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(); }