Пример #1
0
        private static void GetDepartmentAndManager()
        {
            var context = new SoftUniEntities();
            var employees = context.Employees
                .Where(e => e.Manager != null)
                .OrderBy(d => d.Department.Name)
                .ThenBy(m => m.Manager.FirstName + " " + m.Manager.LastName)
                .ToList();

            employees.ForEach(e =>
            {
                Console.WriteLine("{0} Dep: {1}, Manager {2}",
                    e.FirstName + " " + e.LastName,
                    e.Department.Name,
                    e.Manager.FirstName + " " + e.Manager.LastName);
            });
        }
Пример #2
0
        private static void GetDepartmentAndManager()
        {
            var context   = new SoftUniEntities();
            var employees = context.Employees
                            .Where(e => e.Manager != null)
                            .OrderBy(d => d.Department.Name)
                            .ThenBy(m => m.Manager.FirstName + " " + m.Manager.LastName)
                            .ToList();

            employees.ForEach(e =>
            {
                Console.WriteLine("{0} Dep: {1}, Manager {2}",
                                  e.FirstName + " " + e.LastName,
                                  e.Department.Name,
                                  e.Manager.FirstName + " " + e.Manager.LastName);
            });
        }