示例#1
0
        private static void QuestionData()
        {
            var db       = new CarDB();
            var question = from car in db.Cars
                           orderby car.BurningInGeneral descending, car.Manufacturer ascending
            select car;

            foreach (var car in question.Take(10))
            {
                Console.WriteLine("{0,-55} {1,-10}", $"{car.Manufacturer} {car.Model}", car.BurningInGeneral);
            }
        }
示例#2
0
        private static void InsertData()
        {
            var cars = ReadFiles("paliwo.csv");
            var db   = new CarDB();

            if (!db.Cars.Any())
            {
                foreach (var car in cars)
                {
                    db.Cars.Add(car);
                }
                db.SaveChanges();
            }
        }