zhaw-dnet2/Tasks/Lab9/EntityFramework/EF6/Program.cs

34 lines
1 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EF6
{
internal class Program
{
static void Main(string[] args)
{
using (FlughafenDBEntities db = new FlughafenDBEntities())
{
var query = from flug in db.Flug
join fluglinie in db.Fluglinie on flug.Fluglinie_ID equals fluglinie.Fluglinie_ID
where flug.Flugnr.Equals("AF1413")
orderby flug.Abflug
select flug;
Console.WriteLine("All flighst in the database:");
foreach (var item in query)
{
Console.WriteLine($"{item.Flug_ID}, {item.Fluglinie.IATA}, {item.Flugnr}, {item.Von}, {item.Nach}, {item.Abflug}, {item.Ankunft}");
}
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}
}
}
}