Advertisement
morgan73

Employees Full Information

Nov 5th, 2017
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.62 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using P02_DatabaseFirst.Data;
  4. namespace P02_DatabaseFirst
  5. {
  6.     public class StartUp
  7.     {
  8.         public static void Main()
  9.         {
  10.             var db = new SoftUniContext();
  11.  
  12.             using (db)
  13.             {
  14.                 var allEmployees = db.Employees
  15.                     .OrderBy(e => e.EmployeeId)
  16.                     .ToList();
  17.  
  18.                 foreach (var em in allEmployees)
  19.                 {
  20.                     Console.WriteLine($"{em.FirstName} {em.LastName} {em.MiddleName} {em.JobTitle} {em.Salary:f2}");
  21.                 }
  22.             }
  23.         }
  24.  
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement