Пример #1
0
        public List <Employee> GetAllEmployees()
        {
            var context = _commonMapper.GetCommonDataBAseContext();

            EmployeeSortByEmpCode employeeSortByEmpCode = new EmployeeSortByEmpCode();
            var userList     = context.Query <User>();
            var employeeList = new List <Employee>();

            foreach (var user in userList)
            {
                employeeList.Add(_commonMapper.MapBasicPropertiesOfUserToEmployee(user));
            }
            // employeeList = AttachTitleToEmployee(employeeList);
            employeeList.Sort(employeeSortByEmpCode);
            return(employeeList);
        }
Пример #2
0
        public List <Employee> GetAllEmployees()
        {
            var allUsers        = _utilityCommonDbContext.Query <User>().ToList();
            var allEmployeeList = new List <Employee>();

            foreach (var user in allUsers)
            {
                allEmployeeList.Add(_commonMapper.MapBasicPropertiesOfUserToEmployee(user));
            }

            // var allEmployeeList = _context.Query<Employee>().ToList();

            //foreach (Employee emp in allEmployeeList)
            //{
            //    if (emp.EmployeeTitles.Count > 0)
            //    {
            //        var empTitle = emp.EmployeeTitles.Where(title => title.IsCurrent == true).SingleOrDefault().Title;
            //        emp.Title = empTitle.Name;
            //        emp.TitleId = empTitle.TitleId;
            //    }
            //}

            return(allEmployeeList);
        }