private static void GetAllDetailTest() { CarManager carManager = new CarManager(new EfCarDal()); foreach (var car in carManager.GetAllDetails()) { Console.WriteLine($"{car.Id} {car.Brand} {car.Model} {car.ModelYear} {car.Color} {car.DailyPrice} "); } }
private static void Rentalless() { CarManager carManager = new CarManager(new EfCarDal()); Console.WriteLine("---------------Brand'a Göre geldi--------------------------------"); foreach (var cars in carManager.GetAllByBrandId(2).Data) { Console.WriteLine(cars.Description); } Console.WriteLine("-------------------Color'a Göre Geldi----------------------------"); foreach (var cars in carManager.GetAllByColorId(1).Data) { Console.WriteLine(cars.Description); } Console.WriteLine("-------------------Komple Geldi----------------------------"); foreach (var cars in carManager.GetAll().Data) { Console.WriteLine(cars.Description); } Car car1 = new Car { Id = 5, BrandId = 1, ColorId = 2, DailyPrice = 150, ModelYear = 1987, Description = "" }; carManager.Add(car1); Console.WriteLine("-------------------Eklenmediğinden Eskisi gibi geldi Çünkü Description en az 2 uzunluğunda olmalıydı----------------------------"); foreach (var cars in carManager.GetAll().Data) { Console.WriteLine(cars.Description); } Console.WriteLine("-------------------Tablolar Birleşti / Hepsi geldi ----------------------------"); if (carManager.GetAllDetails().Success == true) { foreach (var cars in carManager.GetAllDetails().Data) { Console.WriteLine(cars.BrandName + " markasında " + cars.ColorName + " renginde " + cars.Description + " bir araba"); } } else { Console.WriteLine(carManager.GetAllDetails().Message); }; }
private static void CarBrandandColorTest() { ICarService carService = new CarManager(new EfCarDal()); IBrandService brandService = new BrandManager(new EfBrandDal()); IColorService colorService = new ColorManager(new EfColorDal()); foreach (Car car in carService.GetAll().Data) { Console.WriteLine($"\n {car.Id} kodlu araba bilgileri : {car.Name} , Günlük ücret {car.DailyPrice} , Model Yılı {car.ModelYear} \n"); } foreach (CarDetailDto carDetail in carService.GetAllDetails().Data) { Console.WriteLine($"{carDetail.Id} - {carDetail.BrandName} - {carDetail.CarName} - {carDetail.ColorName} - {carDetail.DailyPrice}"); } foreach (Color color in colorService.GetAll().Data) { Console.WriteLine($"{color.Id} kodlu renk : {color.Name}"); } foreach (Brand brand in brandService.GetAll().Data) { Console.WriteLine($"{brand.Id} kodlu marka : {brand.Name}"); } }