Advertisement
StoyanGrigorov

10

Feb 23rd, 2017
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.68 KB | None | 0 0
  1.         private static void DepWithMoreThan5Emp()
  2.         {
  3.             using (var context = new SoftUniContext())
  4.             {
  5.                 var departments = context.Departments
  6.                     .Where(x => x.Employees.Count > 5)
  7.                     .OrderBy(x => x.Employees.Count);
  8.  
  9.                 foreach (var d in departments)
  10.                 {
  11.                     Console.WriteLine($"{d.Name} {d.Employee.FirstName}");
  12.                     foreach (var e in d.Employees.OrderBy(e => e.EmployeeID))
  13.                     {
  14.                         Console.WriteLine($"{e.FirstName} {e.LastName} {e.JobTitle}");
  15.                     }
  16.                 }
  17.             }
  18.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement