Exemple #1
0
        static void Main(string[] args)
        {
            //Product p = new Product();
            //p.Name = "Monitor";
            //p.Brand = "Samsung";


            //using (DBModelContainer db = new DBModelContainer())
            //{
            //    db.Products.Add(p);
            //    db.SaveChanges();

            //}

            using (DBModelContainer db = new DBModelContainer())
            {
                //List<Product> PList = (from p in db.Products select p).ToList();

                //var q = from p in db.Products select p;
                //List<Product> PList = q.ToList();

                //foreach (Product p in PList)

                var q = from p in db.Products select p;
                foreach (Product p in q)

                {
                    Console.WriteLine($"{p.Id} - {p.Name} {p.Brand}");
                }

                Console.ReadKey();
            }
        }
 static void Main(string[] args)
 {
     using (DBModelContainer db = new DBModelContainer()) {
         List <Student> StudentList = db.Students.ToList();
         foreach (Student s in StudentList)
         {
             Console.WriteLine($"{s.sFirstName} {s.sLastName} ");
         }
         Console.ReadKey();
     }
 }