Beispiel #1
0
        //Lấy nhân viên theo positionId
        public Employee getEmployeeByPositionId(int positionId)
        {
            /*
             * Employee employee = new Employee();
             * employees.ForEach(emp =>
             * {
             *  // Console.WriteLine(emp.Position.PositionName);
             *  if (emp.PositionId == positionId)
             *  {
             *      employee = emp;
             *  }
             * });
             * return employee;*/
            db = new LinQDataContext();
            var result = db.getEmployeesByPosition(positionId).FirstOrDefault();

            if (result != null)
            {
                Employee employee = new Employee();
                return(setEmployeeFromResult(employee, result));
            }
            return(null);
        }