public static EmployeesResult GetEmployees(int skip, int take) { var ctx = new PubsDataContext(); return new EmployeesResult { TotalRecords = ctx.employee.Count(), Employees = ctx.employee.Skip(skip).Take(take).Select(x => new Employee { EmployeeID = x.emp_id, FirstName = x.fname, LastName = x.lname }).ToList() }; }
public static Employee GetDetails(string employeeID) { var ctx = new PubsDataContext(); var emp = ctx.employee.FirstOrDefault(x => x.emp_id == employeeID); if (emp == null) { return null; } return new Employee { EmployeeID = emp.emp_id, FirstName = emp.fname, LastName = emp.lname }; }