Exemple #1
0
        static void Main(string[] args)
        {
            Car car = new Car();

            car.Id          = 5;
            car.BrandId     = 6;
            car.ColorId     = 10;
            car.DailyPrice  = 350;
            car.Description = "Peugoet 301";
            car.ModelYear   = 2016;


            ICarDal cars = new InMemoryCarDal();

            cars.Add(car);
            cars.Delete(3);
            cars.GetAll();
            cars.GetById(4);
            cars.Update(2, car);
        }
Exemple #2
0
        static void Main(string[] args)
        {
            CarManager carManager = new CarManager(new InMemoryCarDal());

            foreach (var car in carManager.GetAll())
            {
                Console.WriteLine(car.Id + " " + car.ModelYear + " " + car.DailyPrice + " " + car.Description);
            }
            Console.WriteLine("-----------");
            foreach (var car in carManager.GetById(3))
            {
                Console.WriteLine(car.Id + " " + car.ModelYear + " " + car.DailyPrice + " " + car.Description);
            }
            Console.WriteLine("-----------");

            InMemoryCarDal inMemoryCarDal = new InMemoryCarDal();

            inMemoryCarDal.Add(new Car
            {
                Id          = 6,
                BrandId     = 4,
                ColorId     = 3,
                DailyPrice  = 94500,
                ModelYear   = "2009",
                Description = "Nissan"
            });


            inMemoryCarDal.Update(new Car
            {
                Id          = 5,
                BrandId     = 4,
                ColorId     = 3,
                DailyPrice  = 94500,
                ModelYear   = "2009",
                Description = "Nissan"
            });
        }
Exemple #3
0
        static void Main(string[] args)
        {
            CarManager carManager = new CarManager(new InMemoryCarDal());

            foreach (var car in carManager.GetAll())
            {
                Console.WriteLine(car.Description);
            }

            InMemoryCarDal inMemoryCarDal = new InMemoryCarDal();

            inMemoryCarDal.Add(new Car {
                Id = 6, BrandId = 2, ColorId = 2, DailyPrice = 20000, ModelYear = 1985, Description = "Pembe Araba"
            });
            inMemoryCarDal.Update(new Car {
                Id = 6, BrandId = 2, ColorId = 2, DailyPrice = 60000, ModelYear = 1975, Description = "Lacivert Araba"
            });
            inMemoryCarDal.Delete(new Car {
                Id = 6
            });

            Console.ReadLine();
        }