static void Main(string[] args) { CarProductManager carProductManager = new CarProductManager(new InMemoryProductDal()); foreach (var car in carProductManager.GetAll()) { Console.WriteLine(car.BrandId); } }
private static void GetByIdTest() { Console.WriteLine("Araç Id bilgisine göre veri çekme \n"); CarProductManager carProductManager = new CarProductManager(new EfCarProductDal()); foreach (var car in carProductManager.GetById(1).Data) { Console.WriteLine(" Id: " + car.Id + "\n Marka Id: " + car.BrandId + "\n Renk Id: " + car.ColorId + "\n Araç adı: " + car.CarName + "\n Araç açıklama: " + car.Description + " \n Araç kiralama günlük fiyat: " + car.DailyPrice + "\n Araç model tarihi: " + car.ModelYear); } }
private static void CarGetAllTest() { Console.WriteLine("----------Tüm Araç Listesi---------- \n"); CarProductManager carProductManager = new CarProductManager(new EfCarProductDal()); foreach (var car in carProductManager.GetAll().Data) { Console.WriteLine(" Id: " + car.Id + "\n Marka Id: " + car.BrandId + "\n Renk Id: " + car.ColorId + "\n Araç adı: " + car.CarName + "\n Araç açıklama: " + car.Description + " \n Araç kiralama günlük fiyat: " + car.DailyPrice + "\n Araç model tarihi: " + car.ModelYear); } }
private static void AddCar() { CarProductManager car1 = new CarProductManager(new EfCarDal()); car1.Add(new Car { Id = 5, BrandId = 2, ColorId = 3, DailyPrice = 100, Description = "c*k guzel", ModelYear = 1996, CarName = "Kia", }); CarProductManager car2 = new CarProductManager(new EfCarDal()); car2.Add(new Car { Id = 6, ColorId = 5, DailyPrice = 300, Description = "fena", ModelYear = 2005, CarName = "Opel", BrandId = 2 }); }
private static void CarDeleteTest() { Console.WriteLine("Verilen araç Id'sine göre araç kaydı silme \n"); CarProductManager carProductManager = new CarProductManager(new EfCarProductDal()); carProductManager.Delete(new Car { Id = 3 }); foreach (Car car in carProductManager.GetAll().Data) { Console.WriteLine(" Id: " + car.Id + "\n Marka Id: " + car.BrandId + "\n Renk Id: " + car.ColorId + "\n Araç adı: " + car.CarName + "\n Araç açıklama: " + car.Description + " \n Araç kiralama günlük fiyat: " + car.DailyPrice + "\n Araç model tarihi: " + car.ModelYear); } }
private static void CarAddTest() { Console.WriteLine("Yeni araç kaydı \n"); CarProductManager carProductManager = new CarProductManager(new EfCarProductDal()); carProductManager.Add( new Car { Id = 3, BrandId = 3, ColorId = 3, CarName = "Skoda", ModelYear = 2019, DailyPrice = 800000, Description = "Sıfır" } ); foreach (Car car in carProductManager.GetAll().Data) { Console.WriteLine(" Id: " + car.Id + "\n Marka Id: " + car.BrandId + "\n Renk Id: " + car.ColorId + "\n Araç adı: " + car.CarName + "\n Araç açıklama: " + car.Description + " \n Araç kiralama günlük fiyat: " + car.DailyPrice + "\n Araç model tarihi: " + car.ModelYear); } }
private static void CarTest() { CarProductManager carProductManager = new CarProductManager(new EfCarProductDal()); var result = carProductManager.GetCarDetails(); if (result.Success) { foreach (var car in result.Data) { Console.WriteLine(car.CarName + "---" + car.DailyPrice + "---" + car.BrandName + "---" + car.ColorName); } } else { Console.WriteLine(result.Message); } }
private static void CarUpdateTest() { Console.WriteLine("Verilen Id bilgisine göre o araç kaydının güncelleme işlemi \n"); CarProductManager carProductManager = new CarProductManager(new EfCarProductDal()); carProductManager.Update(new Car { Id = 1, BrandId = 1, ColorId = 2, CarName = "Audi 2", ModelYear = 2010, DailyPrice = 55000, Description = "İkinci el" }); foreach (Car car in carProductManager.GetAll().Data) { Console.WriteLine(" Id: " + car.Id + "\n Marka Id: " + car.BrandId + "\n Renk Id: " + car.ColorId + "\n Araç adı: " + car.CarName + "\n Araç açıklama: " + car.Description + " \n Araç kiralama günlük fiyat: " + car.DailyPrice + "\n Araç model tarihi: " + car.ModelYear); } }
static void Main(string[] args) { //AddCar(); CarProductManager carProductManager = new CarProductManager(new EfCarDal()); Console.WriteLine("-----İsimler-----"); var result = carProductManager.GetAll(); foreach (var car in result.Data) { Console.WriteLine(car.CarName); } Console.WriteLine("-----Renkler-----"); carProductManager.GetAll(); foreach (var car in carProductManager.GetAll().Data) { Console.WriteLine(car.ColorId); } var result1 = carProductManager.GetCarDetails(); foreach (var car3 in result1) { Console.WriteLine(car3.CarName + "/" + car3.BrandName + " /" + car3.CarName); } Console.WriteLine("Hello World!"); }