private static void TestCar() { CarManager carManager = new CarManager(new InMemoryCarDal()); foreach (var car in carManager.GetAll()) { Console.WriteLine(car.CarId + " " + car.BrandId + " " + car.ColorId + " " + car.DailyPrice + " " + car.ModelYear + " " + car.Description); } Console.WriteLine("-------------------------------------"); foreach (var car in carManager.GetById(5)) { Console.WriteLine(car.CarId + " " + car.BrandId + " " + car.ColorId + " " + car.DailyPrice + " " + car.ModelYear + " " + car.Description); } Console.WriteLine("-------------------------------------"); ICarDal carDal = new InMemoryCarDal(); Car car1 = new Car { CarId = 6, BrandId = 6, ColorId = 1, DailyPrice = 2000, ModelYear = 2021, Description = "Yeni eklendi" }; foreach (var car in carManager.GetAll()) { Console.WriteLine(car.CarId + " " + car.BrandId + " " + car.ColorId + " " + car.DailyPrice + " " + car.ModelYear + " " + car.Description); } }
static void Main(string[] args) { InMemoryCarDal inMemoryCarDal = new InMemoryCarDal(); foreach (var car in inMemoryCarDal.GetAll()) { Console.WriteLine(car.Description); } }
static void Main(string[] args) { InMemoryCarDal inMemoryCarDal = new InMemoryCarDal(); foreach (var car in inMemoryCarDal.GetAll()) { Console.WriteLine(car.DailyPrice); } Console.ReadLine(); }
static void Main(string[] args) { ICarDal carDal = new InMemoryCarDal(); List <Car> cars = carDal.GetAll(); foreach (var car in cars) { Console.WriteLine(car.ModelYear); } }
private static void InMemory() { InMemoryCarDal inMemoryCarDal = new InMemoryCarDal(); inMemoryCarDal.Add(new Car { CarId = 6, BrandId = 2, ColorId = 1, DailyPrice = 30000, Description = "Hybrid", ModelYear = "2021" }); CarManager carManager = new CarManager(inMemoryCarDal); foreach (var car in carManager.GetAll().Data) { Console.WriteLine(car.BrandId + " " + car.Description + " " + car.DailyPrice); } List <Brand> brands = new List <Brand> { new Brand { BrandId = 1, BrandName = "Mercedes" }, new Brand { BrandId = 2, BrandName = "Bmw" }, new Brand { BrandId = 3, BrandName = "Audi" } }; List <Color> colors = new List <Color> { new Color { ColorId = 1, ColorName = "Beyaz" }, new Color { ColorId = 2, ColorName = "Siyah" }, new Color { ColorId = 3, ColorName = "Mor" }, new Color { ColorId = 4, ColorName = "Kırmızı" } }; }
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); }
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" }); }
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(); }
public CarManager(InMemoryCarDal ınMemoryCarDal) { this.ınMemoryCarDal = ınMemoryCarDal; }
static void Main(string[] args) { InMemoryCarDal inMemoryCarDal = new InMemoryCarDal(); //CarManager carManager = new CarManager(inMemoryCarDal) //ColorManager colorManager1 = new ColorManager(new InMemoryColorDal()); //BrandManager brandManager1 = new BrandManager(new InMemoryBrandDal()); CarManager carManager = new CarManager(new EfCarDal()); ColorManager colorManager = new ColorManager(new EfColorDal()); BrandManager brandManager = new BrandManager(new EfBrandDal()); TypeOfVehicleManager typesManager = new TypeOfVehicleManager(new EfTypeOfVehicleDal()); UserManager userManager = new UserManager(new EfUserDal()); CustomerManager customerManager = new CustomerManager(new EfCustomerDal()); RentalManager rentalManager = new RentalManager(new EfRentalDal()); brandManager.Add(new Brand { BrandId = 11, BrandName = "Anadol" }); colorManager.Add(new Color { ColorId = 9, ColorName = "Turquaz" }); carManager.Add(new Car { BrandId = 11, ColorId = 9, CarId = 22, ModelYear = 1994, DailyPrice = 50, TypeOfVehicleId = 5 }); Console.WriteLine(rentalManager.Add(new Rental() { CarId = 4, RentalId = 4, CustomerId = 5, }).Success); foreach (var rent in rentalManager.GetAll().Data) { Console.WriteLine("Rent Id: " + rent.RentalId); Console.WriteLine("car id " + rent.CarId); } //Console.WriteLine("Mercedes-Benz Cars: "); //foreach (var carxbrand in carManager.GetCarsByBrandId(2)) //{ // Console.WriteLine( carxbrand.CarId + " " + carxbrand.Description + " Filtered by Brand " + carxbrand.BrandId ); //} //Console.WriteLine("Black Cars: "); //foreach(var carxcolor in carManager.GetCarsByColorId(3)) //{ // Console.WriteLine(carxcolor.CarId + " " + carxcolor.Description + " Filtered by Color "+ carxcolor.ColorId); //} Console.WriteLine(userManager.GetAllDetails().Message); var resultusers = userManager.GetAllDetails().Data; if (userManager.GetAllDetails().Success == true) { foreach (var user in resultusers) { Console.WriteLine("--- " + user.UserId + "---"); Console.WriteLine("User Name: " + user.Name); Console.WriteLine("User SurName: " + user.Surname); Console.WriteLine("User Email: " + user.Email); Console.WriteLine("User's CompanyName : " + user.CompanyName); } } Console.WriteLine("----------------------"); Console.WriteLine(carManager.GetCarDtos().Message); foreach (var car in carManager.GetCarDtos().Data) { Console.WriteLine("----" + car.CarId + "----"); Console.WriteLine("Brand Name: " + car.BrandName); Console.WriteLine("Type: " + car.TypeOfVehicleName); Console.WriteLine("Color: " + car.ColorName); Console.WriteLine("Model Year: " + car.ModelYear); Console.WriteLine("Description: " + car.Description); Console.WriteLine("Daily Price: " + car.DailyPrice); } }