Пример #1
0
        private static void SortByModelYear(CarManager carManager)
        {
            int a = 1;

            Console.WriteLine("Çıkış yıllarına göre sıralama\n----------------------------------------");
            foreach (var car in carManager.GetByModelYear())
            {
                Console.WriteLine("{0}.Fiyat:{1} Çıkış Yılı:{2}\n", a, car.DailyPrice, car.ModelYear);
                a++;
            }
            Console.WriteLine("----------------------------------------");
        }
Пример #2
0
        static void Main(string[] args)
        {
            CarManager   carManager   = new CarManager(new EfCarDal());
            BrandManager brandManager = new BrandManager(new EfBrandDal());
            ColorManager colorManager = new ColorManager(new EfColorDal());

            CarList(carManager, brandManager, colorManager);

            //AddedTest(carManager, brandManager, colorManager);

            //DeletedTest(carManager, brandManager, colorManager);

            //UpdatedTest(carManager, brandManager, colorManager);

            Console.WriteLine("Id'si 1 olan araç bilgileri..");
            Console.WriteLine("Id - - BrandId - ColorId - ModelYear - DailyPrice - Description");
            foreach (var car in carManager.GetByCarsId(1))
            {
                Console.WriteLine(car.CarId + "\t" + car.BrandId + "\t" + car.ColorId + "\t" + car.ModelYear + "\t" + car.DailyPrice + "\t" + car.Description);
            }

            Console.WriteLine("Günlük fiyatı 170 ile 100 arasındaki araçlar..");
            Console.WriteLine("Id - - BrandId - ColorId - ModelYear - DailyPrice - Description");
            foreach (var car in carManager.GetByDailyPrice(100, 170))
            {
                Console.WriteLine(car.CarId + "\t" + car.BrandId + "\t" + car.ColorId + "\t" + car.ModelYear + "\t" + car.DailyPrice + "\t" + car.Description);
            }

            Console.WriteLine("Model yılı 2018 olan araçlar..");
            Console.WriteLine("Id - - BrandId - ColorId - ModelYear - DailyPrice - Description");
            foreach (var car in carManager.GetByModelYear(2018))
            {
                Console.WriteLine(car.CarId + "\t" + car.BrandId + "\t" + car.ColorId + "\t" + car.ModelYear + "\t" + car.DailyPrice + "\t" + car.Description);
            }

            Console.WriteLine("Brand Id si 2 olan marka bilgileri..");
            Console.WriteLine("BrandId - - BrandName");

            Brand brand = brandManager.GetCarsByBrandId(2);

            Console.WriteLine(brand.BrandId + "\t" + brand.BrandName);

            Console.WriteLine("Color Id si 2 olan renk bilgileri..");
            Console.WriteLine("ColorId - - ColorName");

            Color color = colorManager.GetCarsByColorId(2);

            Console.WriteLine(color.ColorId + "\t" + color.ColorName);
        }
Пример #3
0
        static void Main(string[] args)
        {
            CarManager   carManager   = new CarManager(new EfCarDal());
            BrandManager brandManager = new BrandManager(new EfBrandDal());
            ColorManager colorManager = new ColorManager(new EfColorDal());

            bool cikis = true;

            while (cikis)
            {
                Console.WriteLine(
                    "Rent A Car \n---------------------------------------------------------------" +
                    "\n\n1.Araba Ekleme\n" +
                    "2.Araba Silme\n" +
                    "3.Araba Güncelleme\n" +
                    "4.Arabaların Listelenmesi\n" +
                    "5.Arabaların detaylı bir şekilde Listelenmesi\n" +
                    "6.Arabaların Marka Id'sine göre Listelenmesi\n" +
                    "7.Arabaların Renk Id'sine göre Listelenmesi\n" +
                    "8.Araba Id'sine göre Listeleme\n" +
                    "9.Arabaların fiyat aralığına göre Listelenmesi\n" +
                    "10.Arabaların model yılına göre Listelenmesi\n" +
                    "11.Çıkış\n" +
                    "Yukarıdakilerden hangi işlemi gerçekleştirmek istiyorsunuz ?"
                    );

                int number = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("\n---------------------------------------------------------------\n");
                switch (number)
                {
                case 1:
                    Console.WriteLine("Color Listesi");
                    GetAllColor(colorManager);

                    Console.WriteLine("Brand Listesi");
                    GetAllBrand(brandManager);

                    Console.WriteLine("\nBrand Id: ");
                    int brandIdForAdd = Convert.ToInt32(Console.ReadLine());

                    Console.WriteLine("Color Id: ");
                    int colorIdForAdd = Convert.ToInt32(Console.ReadLine());

                    Console.WriteLine("Daily Price: ");
                    decimal dailyPriceForAdd = Convert.ToDecimal(Console.ReadLine());

                    Console.WriteLine("Description : ");
                    string descriptionForAdd = Console.ReadLine();

                    Console.WriteLine("Model Year: ");
                    string modelYearForAdd = Console.ReadLine();

                    Car carForAdd = new Car {
                        BrandId = brandIdForAdd, ColorId = colorIdForAdd, DailyPrice = dailyPriceForAdd, Description = descriptionForAdd, ModelYear = modelYearForAdd
                    };
                    carManager.Add(carForAdd);
                    break;

                case 2:
                    GetAllCarDetails(carManager);
                    Console.WriteLine("Hangi Id'ye sahip arabayı silmek istiyorsunuz? ");
                    int carIdForDelete = Convert.ToInt32(Console.ReadLine());
                    carManager.Delete(carManager.GetById(carIdForDelete));
                    break;


                case 3:
                    GetAllCarDetails(carManager);
                    Console.WriteLine("Car Id: ");
                    int carIdForUpdate = Convert.ToInt32(Console.ReadLine());

                    Console.WriteLine("Brand Id: ");
                    int brandIdForUpdate = Convert.ToInt32(Console.ReadLine());

                    Console.WriteLine("Color Id: ");
                    int colorIdForUpdate = Convert.ToInt32(Console.ReadLine());

                    Console.WriteLine("Daily Price: ");
                    decimal dailyPriceForUpdate = Convert.ToDecimal(Console.ReadLine());

                    Console.WriteLine("Description : ");
                    string descriptionForUpdate = Console.ReadLine();

                    Console.WriteLine("Model Year: ");
                    string modelYearForUpdate = Console.ReadLine();

                    Car carForUpdate = new Car {
                        CarId = carIdForUpdate, BrandId = brandIdForUpdate, ColorId = colorIdForUpdate, DailyPrice = dailyPriceForUpdate, Description = descriptionForUpdate, ModelYear = modelYearForUpdate
                    };
                    carManager.Update(carForUpdate);
                    break;

                case 4:
                    Console.WriteLine("Arabaların Listesi:  \nId\tColor Name\tBrand Name\tModel Year\tDaily Price\tDescriptions");
                    GetAllCar(carManager);
                    break;

                case 5:
                    Console.WriteLine("Arabaların detaylı listesi:  \nId\tColor Name\tBrand Name\tModel Year\tDaily Price\tDescriptions");
                    GetAllCarDetails(carManager);
                    break;

                case 6:
                    GetAllBrand(brandManager);
                    Console.WriteLine("Hangi markaya sahip arabayı görmek istiyorsunuz? Lütfen bir Id numarası yazınız.");
                    int brandIdForCarList = Convert.ToInt32(Console.ReadLine());
                    Console.WriteLine($"\n\nBrand Id'si {brandIdForCarList} olan arabalar: \nId\tColor Name\tBrand Name\tModel Year\tDaily Price\tDescriptions");
                    foreach (var car in carManager.GetAllByBrandId(brandIdForCarList))
                    {
                        Console.WriteLine($"{car.CarId}\t{colorManager.GetById(car.ColorId).ColorName}\t\t{brandManager.GetById(car.BrandId).BrandName}\t\t{car.ModelYear}\t\t{car.DailyPrice}\t\t{car.Description}");
                    }
                    break;

                case 7:
                    GetAllColor(colorManager);
                    Console.WriteLine("Hangi renge sahip arabayı görmek istiyorsunuz? Lütfen bir Id numarası yazınız.");
                    int colorIdForCarList = Convert.ToInt32(Console.ReadLine());
                    Console.WriteLine($"\n\nColor Id'si {colorIdForCarList} olan arabalar: \nId\tColor Name\tBrand Name\tModel Year\tDaily Price\tDescriptions");
                    foreach (var car in carManager.GetAllByColorId(colorIdForCarList))
                    {
                        Console.WriteLine($"{car.CarId}\t{colorManager.GetById(car.ColorId).ColorName}\t\t{brandManager.GetById(car.BrandId).BrandName}\t\t{car.ModelYear}\t\t{car.DailyPrice}\t\t{car.Description}");
                    }
                    break;

                case 8:
                    GetAllCarDetails(carManager);
                    Console.WriteLine("Hangi arabayı görmek istiyorsunuz? Lütfen bir Id numarası yazınız.");
                    int carId = Convert.ToInt32(Console.ReadLine());
                    Console.WriteLine($"\n\nId'si {carId} olan araba: \nId\tColor Name\tBrand Name\tModel Year\tDaily Price\tDescriptions");
                    Car carById = carManager.GetById(carId);
                    Console.WriteLine($"{carById.CarId}\t{colorManager.GetById(carById.ColorId).ColorName}\t\t{brandManager.GetById(carById.BrandId).BrandName}\t\t{carById.ModelYear}\t\t{carById.DailyPrice}\t\t{carById.Description}");
                    break;

                case 9:
                    decimal min = Convert.ToDecimal(Console.ReadLine());
                    decimal max = Convert.ToDecimal(Console.ReadLine());

                    Console.WriteLine($"\n\nGünlük fiyat aralığı {min} ile {max} olan arabalar: \nId\tColor Name\tBrand Name\tModel Year\tDaily Price\tDescriptions");
                    foreach (var car in carManager.GetByDailyPrice(min, max))
                    {
                        Console.WriteLine($"{car.CarId}\t{colorManager.GetById(car.ColorId).ColorName}\t\t{brandManager.GetById(car.BrandId).BrandName}\t\t{car.ModelYear}\t\t{car.DailyPrice}\t\t{car.Description}");
                    }
                    break;

                case 10:
                    GetAllCarDetails(carManager);
                    Console.WriteLine("Hangi model yılına sahip arabayı görmek istiyorsunuz? Lütfen yıl değeri giriniz.");
                    string modelYearForCarList = Console.ReadLine();
                    Console.WriteLine($"\n\nColor Id'si {modelYearForCarList} olan arabalar: \nId\tColor Name\tBrand Name\tModel Year\tDaily Price\tDescriptions");
                    foreach (var car in carManager.GetByModelYear(modelYearForCarList))
                    {
                        Console.WriteLine($"{car.CarId}\t{colorManager.GetById(car.ColorId).ColorName}\t\t{brandManager.GetById(car.BrandId).BrandName}\t\t{car.ModelYear}\t\t{car.DailyPrice}\t\t{car.Description}");
                    }
                    break;

                case 11:
                    cikis = false;
                    Console.WriteLine("Çıkış işlemi gerçekleşti.");
                    break;
                }
            }
        }