예제 #1
0
        private static void BrandManagerTest()
        {
            BrandManager brandManager = new BrandManager(new EfBrandDal());
            Brand        brand        = new Brand()
            {
                BrandId = 1, BrandName = "Audi"
            };
            Brand brand2 = new Brand()
            {
                BrandId = 2, BrandName = "BMW"
            };
            Brand brand3 = new Brand()
            {
                BrandId = 3, BrandName = "Hyundai"
            };

            brandManager.Add(brand);
            brandManager.Add(brand2);
            brandManager.Add(brand3);
            brandManager.Delete(brand2);
            brandManager.Update(brand3);
            foreach (var brandGetAll in brandManager.GetAll().Data)
            {
                Console.WriteLine(brandGetAll.BrandId + "" + brandGetAll.BrandName);
            }
        }
예제 #2
0
        private static void BrandTest()
        {
            var brandManager = new BrandManager(new EfBrandDal());

            brandManager.Add(new Brand()
            {
                Name = "Toyota"
            });
            brandManager.Add(new Brand()
            {
                Name = "Nissan"
            });
            brandManager.Add(new Brand()
            {
                Name = "Honda"
            });
            brandManager.Add(new Brand()
            {
                Name = "Mazda"
            });
            brandManager.Add(new Brand()
            {
                Name = "Hyundai"
            });
            var brands = brandManager.GetAll();

            foreach (var brand in brands.Data)
            {
                Console.WriteLine(brand.Name);
            }
        }
예제 #3
0
        //private static void UserTest()
        //{
        //    UserManager userManager = new UserManager(new EfUserDal());

        //    var result1 = userManager.Add(new User
        //    {
        //        Id = 1,
        //        FirstName = "Özcan",
        //        LastName = "Elmacı",
        //        Email = "*****@*****.**",
        //        Password = 000000
        //    });
        //    var result2 = userManager.Add(new User
        //    {
        //        Id = 2,
        //        FirstName = "User2",
        //        LastName = "Last2",
        //        Email = "Email2",
        //        Password = 22222
        //    });
        //    var result3 = userManager.Add(new User
        //    {
        //        Id = 3,
        //        FirstName = "User3",
        //        LastName = "Last3",
        //        Email = "Email3",
        //        Password = 33333
        //    });
        //    var result4 = userManager.Add(new User
        //    {
        //        Id = 4,
        //        FirstName = "User4",
        //        LastName = "Last4",
        //        Email = "Email4",
        //        Password = 44444
        //    });
        //    Console.WriteLine(result1.Message);
        //    Console.WriteLine(result2.Message);
        //    Console.WriteLine(result3.Message);
        //    Console.WriteLine(result4.Message);
        //    foreach (var user in userManager.GetAll().Data)
        //    {
        //        Console.WriteLine(user.FirstName + " " + user.LastName);
        //    }
        //}

        private static void BrandTest()
        {
            BrandManager brandManager = new BrandManager(new EfBrandDal());

            var result1 = brandManager.Delete(new Brand {
                Id = 2, Name = "Mercedes"
            });
            var result2 = brandManager.Delete(new Brand {
                Id = 3, Name = "Range Rover"
            });

            Console.WriteLine(result1.Message);
            Console.WriteLine(result2.Message);

            var result3 = brandManager.Add(new Brand {
                Id = 2, Name = "Mercedes"
            });
            var result4 = brandManager.Add(new Brand {
                Id = 3, Name = "Range Rover"
            });

            Console.WriteLine(result3.Message);
            Console.WriteLine(result4.Message);
            foreach (var brand in brandManager.GetAll().Data)
            {
                Console.WriteLine(brand.Id + " " + brand.Name);
            }
        }
예제 #4
0
        private static void BrandTest()
        {
            BrandManager brandManager = new BrandManager(new EfBrandDal());

            brandManager.Add(new Brand {
                Name = "Mercedes"
            });
            brandManager.Add(new Brand {
                Name = "Honda"
            });
            brandManager.Delete(new Brand {
                Id = 5
            });

            var result = brandManager.GetAll();

            if (result.Success)
            {
                foreach (var brand in result.Data)
                {
                    Console.WriteLine(brand.Id + "\t" + brand.Name);
                }
            }
            else
            {
                Console.WriteLine(result.Message);
            }
        }
예제 #5
0
        private static void BrandTest()
        {
            BrandManager brandManager = new BrandManager(new EfBrandDal());

            foreach (var brand in brandManager.GetAll().Data)
            {
                Console.WriteLine(brand.BrandName);
            }
            brandManager.Add(new Brand {
                BrandName = "Fiat"
            });
            Brand brand1 = new Brand()
            {
                BrandName = "Ford",
            };

            brandManager.Add(brand1);

            brandManager.Delete(new Brand {
                BrandId = 1006
            });
            brandManager.Update(new Brand {
                BrandId = 2, BrandName = "Dacia"
            });

            brandManager.Update(new Brand
            {
                BrandId   = 1,
                BrandName = "Mercedes",
            });
            foreach (var b in brandManager.GetBrands("Mercedes").Data)
            {
                Console.WriteLine(b.BrandId);
            }
        }
예제 #6
0
 private static void AddBrand()
 {
     BrandManager brandManager = new BrandManager(new EfBrandDal());
     brandManager.Add(new Brand { BrandId = 1, BrandName = "Ford" });
     brandManager.Add(new Brand { BrandId = 2, BrandName = "BMW" });
     brandManager.Add(new Brand { BrandId = 3, BrandName = "Mercedes" });
 }
예제 #7
0
        private static void BrandAddTest(BrandManager brandManager)
        {
            Brand brand1 = new Brand()
            {
                BrandId = 1, BrandName = "Audi"
            };
            Brand brand2 = new Brand()
            {
                BrandId = 2, BrandName = "BMW"
            };
            Brand brand3 = new Brand()
            {
                BrandId = 3, BrandName = "Mercedes"
            };

            brandManager.Add(brand1);
            brandManager.Add(brand2);
            brandManager.Add(brand3);

            //Brand brand4 = new Brand() { BrandId = 4, BrandName = "Opel" };
            //brandManager.Add(brand4);
            //Brand brand4 = new Brand() { BrandId = 4, BrandName = "Opel" };
            //brandManager.Update(brand4);

            //Brand brand5 = new Brand() { BrandId = 5, BrandName = "Ford" };
            //brandManager.Add(brand5);
            //brandManager.Delete(brand5);
        }
예제 #8
0
        private static void BrandAdding(BrandManager brandManager, IDataResult <List <Brand> > brands)
        {
            brandManager.Add(new Brand {
                BrandId = 1, BrandName = "BMW"
            });
            brandManager.Add(new Brand {
                BrandId = 2, BrandName = "Kia"
            });
            brandManager.Add(new Brand {
                BrandId = 3, BrandName = "Audi"
            });
            brandManager.Add(new Brand {
                BrandId = 4, BrandName = "Ford"
            });
            brandManager.Add(new Brand {
                BrandId = 5, BrandName = "Mercedes"
            });

            if (brands.Success == true)
            {
                foreach (var item in brands.Data)
                {
                    Console.WriteLine(item.BrandName);
                }
            }
            else
            {
                Console.WriteLine(brands.Massage);
            }
        }
예제 #9
0
        private static void BrandCrudTest(BrandManager brandManager)
        {
            brandManager.Add(new Brand()
            {
                Name = "Honda"
            });
            brandManager.Add(new Brand()
            {
                Name = "Mercedes"
            });
            brandManager.Add(new Brand()
            {
                Name = "Mitsubushi"
            });
            brandManager.Add(new Brand()
            {
                Name = "Fiat"
            });
            brandManager.Add(new Brand()
            {
                Name = "Tesla"
            });
            //brandManager.Delete(brandManager.GetById(5).Data);


            //Brand UpdatedBrand = brandManager.GetById(1).Data;
            //UpdatedBrand.Name = "Hyundai";
            //brandManager.Update(UpdatedBrand);
        }
예제 #10
0
        private static void BeforeHomeWorkTest()
        {
            CarManager   carManager   = new CarManager(new EfCarDal());
            BrandManager brandManager = new BrandManager(new EfBrandDal());
            ColorManager colorManager = new ColorManager(new EfColorDal());

            brandManager.Add(new Brand()
            {
                BrandName = "a"
            });                                                // 2 karakterden az bir model ismi ekleme denendi.

            brandManager.Add(new Brand()
            {
                BrandName = "Tofaş"
            });                                                    //id göndermedik çünkü tablomuzda otomatik artan

            void ListCar()
            {
                Console.WriteLine("Color\tYear\tBrand\tDescription\tDaily Price\n");
                foreach (var car in carManager.GetAll().Data)
                {
                    Console.WriteLine(colorManager.GetById(car.ColorId).Data.Name + "\t"
                                      + car.ModelYear + "\t" + brandManager.GetById(car.BrandId).Data.BrandName + "\t"
                                      + car.Description + "\t\t" + car.DailyPrice + " TL"
                                      );
                }
            }

            // Brand idsi =2 olan arabalar
            Console.WriteLine("--------------------Brand id =2-------------------------");
            Console.WriteLine("BrandID\tColor\tYear\tBrand\tDescription\tDaily Price\n");
            foreach (var car in carManager.GetCarsByBrandId(2).Data)
            {
                Console.WriteLine(car.BrandId + "\t" + colorManager.GetById(car.ColorId).Data.Name + "\t"
                                  + car.ModelYear + "\t" + brandManager.GetById(car.BrandId).Data.BrandName + "\t" + car.Description + "\t\t" + car.DailyPrice);
            }

            // Color idsi = 3 olan arabalar
            Console.WriteLine("\n--------------------Color id =3--------------------------");
            Console.WriteLine("ColorID\tColor\tYear\tBrand\tDescription\tDaily Price\n");

            foreach (var car in carManager.GetCarsByColorId(3).Data)
            {
                Console.WriteLine(car.ColorId + "\t" + colorManager.GetById(car.ColorId).Data.Name + "\t"
                                  + car.ModelYear + "\t" + brandManager.GetById(car.BrandId).Data.BrandName + "\t" + car.Description + "\t\t" + car.DailyPrice);
            }

            carManager.Add(new Car()
            {
                ColorId = 5, ModelYear = 1995, BrandId = 4, Description = "Lpg", DailyPrice = -50
            });

            carManager.Add(new Car()
            {
                ColorId = 5, ModelYear = 1995, BrandId = 4, Description = "Lpg", DailyPrice = 150
            });

            ListCar();
        }
예제 #11
0
 private static void addingBrand(BrandManager brandManager)
 {
     brandManager.Add(new Brand {
         Name = "Bugatti"
     });
     brandManager.Add(new Brand {
         Name = "m35"
     });
 }
예제 #12
0
        private static void CarTest(CarManager carManager, BrandManager brandManager)
        {
            Console.WriteLine("BrandId'ye göre arabalar (3)");
            foreach (var car in carManager.GetCarsByBrandId(3).Data)
            {
                Console.WriteLine(car.CarId + " " + car.BrandId + " " + car.DailyPrice + " " + car.Description);
            }

            Console.WriteLine("ColorId'ye göre arabalar (2)");
            foreach (var car in carManager.GetCarsByColorId(2).Data)
            {
                Console.WriteLine(car.CarId + " " + car.ColorId + " " + car.DailyPrice + " " + car.Description);
            }

            Console.WriteLine("Bütün arabalar");
            foreach (var car in carManager.GetAll().Data)
            {
                Console.WriteLine(car.CarId + "  " + car.BrandId + "  " + car.DailyPrice + "  " + car.Description);
            }
            carManager.Add(new Car {
                BrandId = 1, ColorId = 2, DailyPrice = 5555, ModelYear = 1955, Description = "Low"
            });
            brandManager.Add(new Brand {
                BrandName = "Bugatti"
            });

            carManager.Add(new Car {
                BrandId = 4, ColorId = 1, DailyPrice = -2000, ModelYear = 2002, Description = "Low"
            });
            brandManager.Add(new Brand {
                BrandName = "f"
            });

            Console.WriteLine("Eklemeden sonra bütün arabalar");
            foreach (var car in carManager.GetAll().Data)
            {
                Console.WriteLine(car.CarId + "  " + car.BrandId + "  " + car.DailyPrice + "  " + car.Description);
            }

            carManager.Update(new Car {
                CarId = 9, BrandId = 1, ColorId = 3, DailyPrice = 9999, ModelYear = 2010, Description = "Middle"
            });
            Console.WriteLine("Güncellemeden sonra bütün arabalar");
            foreach (var car in carManager.GetAll().Data)
            {
                Console.WriteLine(car.CarId + "  " + car.BrandId + "  " + car.DailyPrice + "  " + car.Description);
            }

            carManager.Delete(new Car {
                CarId = 6
            });
            Console.WriteLine("Silmeden sonra bütün arabalar");
            foreach (var car in carManager.GetAll().Data)
            {
                Console.WriteLine(car.CarId + "  " + car.BrandId + "  " + car.DailyPrice + "  " + car.Description);
            }
        }
예제 #13
0
        private static void AddBrandTest()
        {
            BrandManager brandManager = new BrandManager(new EfBrandDal());
            Brand        brand1       = new Brand {
                BrandName = "E"
            };

            brandManager.Add(brand1);
            Console.WriteLine(brandManager.Add(brand1).Message);
        }
예제 #14
0
 private static void BrandAddTest(ref BrandManager brandManager)
 {
     brandManager.Add(new Brand
     {
         BrandName = "Renault"
     });
     brandManager.Add(new Brand
     {
         BrandName = "Opel"
     });
 }
예제 #15
0
        private static void BrandAddingTest()
        {
            BrandManager brandManager = new BrandManager(new EfBrandDal());

            brandManager.Add(new Brand {
                BrandName = "Peugeot"
            });
            brandManager.Add(new Brand {
                BrandName = "Tesla"
            });
        }
예제 #16
0
 private static void AddedBrand(BrandManager brandManager)
 {
     brandManager.Add(new Brand()
     {
         Name = "Fiat"
     });
     brandManager.Add(new Brand()
     {
         Name = "Mazda"
     });
 }
예제 #17
0
        private static void BrandTest()
        {
            BrandManager brandManager = new BrandManager(new EfBrandDal());

            brandManager.Add(new Brand {
                Id = 1, Name = "Fiat"
            });
            brandManager.Add(new Brand {
                Id = 2, Name = "Honda"
            });
        }
예제 #18
0
        private static void BrandTest()
        {
            BrandManager brandManager = new BrandManager(new EfBrandDal());

            brandManager.Add(new Brand
            {
                BrandName = "Range Rover",
            });
            brandManager.Add(new Brand
            {
                BrandName = "Mercedes",
            });
        }
예제 #19
0
        public static void BrandsCRUDOP(BrandManager brandManager)
        {
            //CRUD Brand
            brandManager.Add(new Brand()
            {
                Id = 1, Name = "Mercedes"
            });
            brandManager.Add(new Brand()
            {
                Id = 2, Name = "Nissan"
            });
            brandManager.Add(new Brand()
            {
                Id = 3, Name = "Kia"
            });
            brandManager.Add(new Brand()
            {
                Id = 4, Name = "Citroen"
            });
            brandManager.Add(new Brand()
            {
                Id = 5, Name = "Peugeot"
            });

            Console.WriteLine("Brands:");
            foreach (var brand in brandManager.GetAll())
            {
                Console.WriteLine(brand.Name);
            }
            Brand brandToUpdate = brandManager.GetById(4);

            brandToUpdate.Name = "BMW";
            brandManager.Update(brandToUpdate);

            Console.WriteLine();
            Console.WriteLine("Brands:");
            foreach (var brand in brandManager.GetAll())
            {
                Console.WriteLine(brand.Name);
            }
            Brand brandToDelete = brandManager.GetById(5);

            brandManager.Delete(brandToDelete);

            Console.WriteLine();
            Console.WriteLine("Brands:");
            foreach (var brand in brandManager.GetAll())
            {
                Console.WriteLine(brand.Name);
            }
        }
예제 #20
0
 private static void AddBrand(BrandManager brandManager)
 {
     brandManager.Add(new Brand()
     {
         BrandId = 1, Name = "BMW"
     });
     brandManager.Add(new Brand()
     {
         BrandId = 2, Name = "Mercedes"
     });
     brandManager.Add(new Brand()
     {
         BrandId = 3, Name = "Tesla"
     });
 }
예제 #21
0
        private static void BrandTest()
        {
            BrandManager brandManager = new BrandManager(new EfBrandDal());

            brandManager.Add(new Brand {
                BrandName = "BMW"
            });
            brandManager.Add(new Brand {
                BrandName = "Mercedes"
            });
            foreach (var brand in brandManager.GetAll().Data)
            {
                System.Console.WriteLine(brand.BrandName);
            }
        }
예제 #22
0
        private static void brandManagerTest(BrandManager brandManager)
        {
            Brand brand1 = new Brand {
                BrandId = 8, BrandName = "Lamborgini"
            };
            Brand brand2 = new Brand {
                BrandId = 9, BrandName = "Audi"
            };

            brandManager.Add(brand1);
            brandManager.Add(brand2);
            var getBrand = brandManager.GetBrand(1);

            brandManager.Delete(brand2);
        }
예제 #23
0
 private static void BrandAddTest(BrandManager brand)
 {
     brand.Add(new Brand {
         Id = 1, Name = "Mercedes"
     });
     brand.Add(new Brand {
         Id = 2, Name = "Range Rover"
     });
     brand.Add(new Brand {
         Id = 3, Name = "Audi"
     });
     brand.Add(new Brand {
         Id = 4, Name = "Hundai"
     });
 }
예제 #24
0
        private static void Test1()
        {
            CarManager   carManager   = new CarManager(new EfCarDal());
            ColorManager colorManager = new ColorManager(new EfColorDal());
            BrandManager brandManager = new BrandManager(new EfBrandDal());


            colorManager.Add(new Color {
                Id = 1, ColorName = "Yeşil"
            });

            brandManager.Add(new Brand {
                Id = 1, BrandName = "Opel"
            });

            carManager.Add(new Car {
                Id = 1, ColorId = 1, BrandId = 1, ModelYear = 2015, DailyPrice = 350, Description = "Opel Kiralama Bedeli"
            });


            //foreach (var car in carManager.GetAll())
            //{
            //    Console.WriteLine(car.Description);
            //}
        }
예제 #25
0
        private static void BrandTest()
        {
            BrandManager bm = new BrandManager(new EfBrandDAL());
            Brand        b1 = new Brand {
                BrandName = "Toyota"
            };

            bm.Add(b1);
            foreach (var b in bm.GetAll().Data)
            {
                Console.WriteLine(b.BrandName);
            }
            Console.WriteLine("-----------------------------------------");
            b1.BrandName = "Toyata 1";
            bm.Update(b1);
            foreach (var b in bm.GetAll().Data)
            {
                Console.WriteLine(b.BrandName);
            }
            Console.WriteLine("-----------------------------------------");
            bm.Delete(b1);
            foreach (var b in bm.GetAll().Data)
            {
                Console.WriteLine(b.BrandName);
            }
        }
예제 #26
0
        private static void Brandtest()
        {
            BrandManager brandManager = new BrandManager(new EfBrandDal());
            Brand        brand        = new Brand
            {
                BrandId   = 3,
                BrandName = "bmw"
            };

            brandManager.Add(brand);

            Console.WriteLine("marka listesi:");
            foreach (var brand1 in brandManager.GetAll().Data)
            {
                Console.WriteLine(brand1.BrandName);
            }

            brand.BrandName = "volvo";
            brandManager.Update(brand);

            Console.WriteLine("güncel marka listesi:");
            foreach (var brand1 in brandManager.GetAll().Data)
            {
                Console.WriteLine(brand1.BrandName);
            }

            brandManager.Delete(brand);
        }
예제 #27
0
 private static void BrandAddTest(BrandManager brandManager1)
 {
     brandManager1.Add(new Brand {
         BrandName = "Ford"
     });
     brandManager1.GetById(Id: 1);
 }
예제 #28
0
        private static void EfBrandDalTest()
        {
            BrandManager brandManager = new BrandManager(new EfBrandDal());

            Brand brand1 = new Brand()
            {
                BrandName = "Scania"
            };

            Console.WriteLine("\nInitial records of Brands table: ");
            foreach (Brand brand in brandManager.GetAll().Data)
            {
                Console.WriteLine(brand.BrandName);
            }

            Console.WriteLine("\nAdding brand: {0} to Brands table", brand1.BrandName);
            brandManager.Add(brand1);

            Console.WriteLine("\nList of brands: ");
            foreach (Brand brand in brandManager.GetAll().Data)
            {
                Console.WriteLine(brand.BrandName);
            }

            Console.WriteLine("\nRemoving brand: {0} from Brands table", brand1.BrandName);
            brandManager.Delete(brand1);

            Console.WriteLine("\nList of brands: ");
            foreach (Brand brand in brandManager.GetAll().Data)
            {
                Console.WriteLine(brand.BrandName);
            }

            Console.WriteLine("\nBrand with id 1 is: {0}", brandManager.GetById(1).Data.BrandName);
        }
예제 #29
0
        private static void BrandCRUD()
        {
            BrandManager _brandManager = new BrandManager(new EfBrandDal());

            Console.WriteLine("Tüm markalarımız:");
            foreach (var brand in _brandManager.GetAll().Data)
            {
                Console.WriteLine(brand.BrandName);
            }

            Console.WriteLine("İstediğiniz marka:");
            Console.WriteLine(_brandManager.GetById(1).Data.BrandName);

            Console.WriteLine("Marka eklendi.");
            _brandManager.Add(new Brand()
            {
                BrandName = "Hyundai"
            });

            Console.WriteLine("Marka güncellendi");
            _brandManager.Update(new Brand()
            {
                Id = 5, BrandName = "Aston Martin"
            });

            Console.WriteLine("Marka silindi");
            _brandManager.Delete(new Brand()
            {
                Id = 5
            });
        }
예제 #30
0
        private static void CarTest()
        {
            CarManager carManager = new CarManager(new EfCarDal());
            ////carManager.Add(new Car { Id = 5, BrandId = 3, ColorId = 2, Description = "B", DailyPrice = 100, ModelYear = 2020 });


            ColorManager colorManager = new ColorManager(new EfColorDal());

            colorManager.Add(new Color {
                Id = 2, ColorName = "mavi"
            });
            BrandManager brandManager = new BrandManager(new EfBrandDal());

            brandManager.Add(new Brand {
                Id = 3, BrandName = "Toyota"
            });

            carManager.Add(new Car {
                Id = 1, BrandId = 3, ColorId = 2, Description = "BMW", DailyPrice = 100, ModelYear = 2020
            });
            carManager.Add(new Car {
                Id = 2, BrandId = 3, ColorId = 2, Description = "Mercedes", DailyPrice = 100, ModelYear = 2020
            });
            //carManager.Add(new Car { Id = 2, BrandId = 3, ColorId = 2, Description = "Mercedes", DailyPrice = 100, ModelYear = 2020 });

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