Exemplo n.º 1
0
        private static void ColorTest()
        {
            ColorManager colorManager = new ColorManager(new EfColorDal());

            var result1 = colorManager.Delete(new Color {
                Id = 2, Name = "Orange"
            });
            var result2 = colorManager.Delete(new Color {
                Id = 3, Name = "Red"
            });

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

            var result3 = colorManager.Add(new Color {
                Id = 2, Name = "Orange"
            });
            var result4 = colorManager.Add(new Color {
                Id = 3, Name = "Red"
            });

            Console.WriteLine(result3.Message);
            Console.WriteLine(result4.Message);
            foreach (var color in colorManager.GetAll().Data)
            {
                Console.WriteLine(color.Id + " " + color.Name);
            }
        }
Exemplo n.º 2
0
        private static void ColorTest()
        {
            ColorManager colorManager = new ColorManager(new EfColorDal());

            colorManager.Add(new Color {
                Id = 1, Name = "Mavi"
            });
            colorManager.Add(new Color {
                Id = 2, Name = "Beyaz"
            });
            colorManager.Add(new Color {
                Id = 3, Name = "SIYAH"
            });
            colorManager.Add(new Color {
                Id = 1, Name = "Gri"
            });                                                             //Id=1 mevcut olduğundan hata mesajı verecektir
            colorManager.Add(new Color {
                Id = 4, Name = "Gri"
            });

            Console.WriteLine("\n--- Ekleme sonrası renk listesi ---\n");

            foreach (var color in colorManager.GetAll().Data)
            {
                Console.WriteLine("id: {0} Renk: {1}", color.Id, color.Name);
            }

            var result1 = colorManager.GetById(1).Data;

            result1.Name = "Kırmızı";
            colorManager.Update(result1);

            var result2 = colorManager.GetById(3).Data;

            result2.Name = "Siyah";
            colorManager.Update(result2);

            Console.WriteLine("\n--- Güncelleme sonrası renk listesi ---\n");

            foreach (var color in colorManager.GetAll().Data)
            {
                Console.WriteLine("id: {0} Renk: {1}", color.Id, color.Name);
            }

            colorManager.Delete(colorManager.GetById(3).Data);
            colorManager.Delete(colorManager.GetById(4).Data);

            Console.WriteLine("\n--- Silme sonrası renk listesi ---\n");

            foreach (var color in colorManager.GetAll().Data)
            {
                Console.WriteLine("id: {0} Renk: {1}", color.Id, color.Name);
            }
        }
Exemplo n.º 3
0
        private static void CrudOperationsTestForColors()
        {
            ColorManager colorManager = new ColorManager(new EfColorDal());

            foreach (var color in colorManager.GetAll().Data)
            {
                Console.WriteLine(color.Name);
            }
            Console.WriteLine("-------");
            Console.WriteLine(colorManager.GetById(1).Data.Name);
            Color newColor = new Color()
            {
                Name = "Mavi"
            };

            colorManager.Add(newColor);
            Console.WriteLine("-------");
            foreach (var color in colorManager.GetAll().Data)
            {
                Console.WriteLine(color.Name);
            }
            Console.WriteLine("-------");
            colorManager.Update(newColor);
            colorManager.Delete(newColor);
            foreach (var color in colorManager.GetAll().Data)
            {
                Console.WriteLine(color.Name);
            }
            Console.WriteLine("-------");
        }
Exemplo n.º 4
0
        private static void ColorCRUDTest()
        {
            ColorManager colorManager      = new ColorManager(new EfColorDal());
            Color        colorAddandDelete = new Color()
            {
                ColorName = "EklenenRenk"
            };

            Console.WriteLine("Eklemeden once \n");
            ColorTest();

            colorManager.Add(colorAddandDelete);
            Console.WriteLine("Ekledikten Sonra \n");
            ColorTest();

            colorManager.Delete(colorAddandDelete);
            Console.WriteLine("Sildikten sonra \n");
            ColorTest();

            Color colorUpdated = new Color()
            {
                ColorId = 1, ColorName = "GuncelenenRenk"
            };

            colorManager.Update(colorUpdated);

            Console.WriteLine("Guncellendikten sonra \n");
            ColorTest();
        }
Exemplo n.º 5
0
        private static void ColorTest()
        {
            ColorManager colorManager = new ColorManager(new EfColorDal());

            //Yeni renk ekleme
            var colorAdded = colorManager.Add(new Color
            {
                ColorName = "Sarı"
            });

            Console.WriteLine(colorAdded.Message);


            //Renk silme ve güncelleme
            var colorUpdated = colorManager.Update(new Color {
                ColorId = 5, ColorName = "Kırmızı"
            });

            Console.WriteLine(colorUpdated.Message);
            var colorDeleted = colorManager.Delete(new Color {
                ColorId = 7
            });

            Console.WriteLine(colorDeleted.Message);

            //Renklerin tümünün ve ID'ye göre istenen rengin listelenmesi
            Console.WriteLine("--------------Tüm renkler listelendi-------------");
            foreach (var color in colorManager.GetAll().Data)
            {
                Console.WriteLine(color.ColorName);
            }

            Console.WriteLine("--------------Renk idleri-------------");
            Console.WriteLine(colorManager.GetById(2).Data);
        }
Exemplo n.º 6
0
        private static void ColorTest(ColorManager colorManager)
        {
            Console.WriteLine("*****************Mevcut Renkler****************");
            foreach (var color in colorManager.GetAll())
            {
                Console.WriteLine("Renk Id:{0}     Renk Adı:{1}", color.ColorId, color.ColorName);
            }

            Console.WriteLine("\n*****************Mevcut Renkler****************");
            colorManager.Add(new Color {
                ColorName = "Mavi"
            });
            foreach (var color in colorManager.GetAll())
            {
                Console.WriteLine("Renk Id:{0}     Renk Adı:{1}", color.ColorId, color.ColorName);
            }

            Console.WriteLine("\n*****************Mevcut Renkler****************");
            colorManager.Update(new Color {
                ColorId = 5, ColorName = "Lacivert"
            });
            foreach (var color in colorManager.GetAll())
            {
                Console.WriteLine("Renk Id:{0}     Renk Adı:{1}", color.ColorId, color.ColorName);
            }

            Console.WriteLine("\n*****************Mevcut Renkler****************");
            colorManager.Delete(new Color {
                ColorId = 5, ColorName = "Lacivert"
            });
            foreach (var color in colorManager.GetAll())
            {
                Console.WriteLine("Marka Id:{0}     Marka Adı:{1}", color.ColorId, color.ColorName);
            }
        }
Exemplo n.º 7
0
        private static void ColorCrudTest(ColorManager colorManager)
        {
            Console.WriteLine(colorManager.GetById(5));
            Color color1 = new Color()
            {
                ColorName = "Dark Green"
            };

            Console.WriteLine("Renk ekleme");
            colorManager.Add(color1);
            foreach (var color in colorManager.GetAll().Data)
            {
                Console.WriteLine(color.ColorName);
            }
            Console.WriteLine("Renk guncelleme islemi");
            colorManager.Update(new Color {
                ColorId = 1002, ColorName = "deneme"
            });
            foreach (var color in colorManager.GetAll().Data)
            {
                Console.WriteLine(color.ColorName);
            }
            Console.WriteLine("Renk silme islemi");
            colorManager.Delete(new Color {
                ColorId = 1002
            });
            foreach (var color in colorManager.GetAll().Data)
            {
                Console.WriteLine(color.ColorName);
            }
        }
Exemplo n.º 8
0
        private static void RenkSilme(ColorManager colorManager)
        {
            Console.WriteLine("                              ");
            Console.WriteLine("******************************");
            Console.WriteLine("*****    Renke Silme   ******");
            Console.WriteLine("******************************");
            Console.WriteLine("                              ");


            var result11 = colorManager.Delete(new Color {
                Id = 1004, ColorName = "Blue"
            });

            if (result11.Success)
            {
                Console.WriteLine(result11.Message);
                foreach (var color in colorManager.GetAll().Data)
                {
                    Console.WriteLine(color.ColorName);
                }
            }
            else
            {
                Console.WriteLine(result11.Message);
            }
        }
Exemplo n.º 9
0
        private static void ColorMnagerTest()
        {
            ColorManager colorManager = new ColorManager(new EFColorDal());

            foreach (var color in colorManager.GetAll().Data)
            {
                Console.WriteLine(color.Id + "/" + color.Name);
            }
            Console.WriteLine("1 nolu Id'li rengin adı: " + colorManager.GetById(1).Data.Name);

            Color color1 = new Color()
            {
                Name = " Pembe"
            };

            colorManager.Add(color1);
            Console.WriteLine("Pembe rengini ekledikten sonra database durumu");
            foreach (var color in colorManager.GetAll().Data)
            {
                Console.WriteLine(color.Id + "/" + color.Name);
            }

            colorManager.Update(color1);
            colorManager.Delete(color1);
            Console.WriteLine("pembe rengini güncelleme ve silinmesinden sonra database durumu");
            foreach (var color in colorManager.GetAll().Data)
            {
                Console.WriteLine(color.Id + "/" + color.Name);
            }
        }
Exemplo n.º 10
0
        static void Main(string[] args)
        {
            CarManager   carManager   = new CarManager(new EfCarDal());
            ColorManager colorManager = new ColorManager(new EfColorDal());
            BrandManager brandManager = new BrandManager(new EfBrandDal());

            //carManager.Delete(new Car { Id = 8 });
            colorManager.Delete(new Color {
                Id = 8
            });
            brandManager.Delete(new Brand {
                Id = 8
            });

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

            //foreach (var color in colorManager.GetAll())
            //{
            //    Console.WriteLine(color.Name);
            //}
            //foreach (var brand in brandManager.GetAll())
            //{
            //    Console.WriteLine(brand.Name);
            //}
        }
Exemplo n.º 11
0
        private static void ColorCRUD()
        {
            ColorManager _colorManager = new ColorManager(new EfColorDal());

            Console.WriteLine("Tüm renklerimiz:");
            foreach (var color in _colorManager.GetAll().Data)
            {
                Console.WriteLine(color.ColorName);
            }

            Console.WriteLine("İstediğiniz renk:");
            Console.WriteLine(_colorManager.GetById(1).Data.ColorName);

            Console.WriteLine("renk eklendi.");
            _colorManager.Add(new Color()
            {
                ColorName = "Turuncu"
            });

            Console.WriteLine("renk güncellendi");
            _colorManager.Update(new Color()
            {
                Id = 6, ColorName = "Fuşya"
            });

            Console.WriteLine("renk silindi");
            _colorManager.Delete(new Color()
            {
                Id = 6
            });
        }
Exemplo n.º 12
0
        private static void ColorTest()
        {
            ColorManager cm = new ColorManager(new EfColorDAL());
            Color        c  = new Color {
                ColorName = "Gri"
            };

            cm.Add(c);
            foreach (var c1 in cm.GetAll().Data)
            {
                Console.WriteLine(c1.ColorName);
            }
            Console.WriteLine("-----------------------------------------");
            Color c2 = cm.GetById(1).Data;

            c2.ColorName = "Turkuaz";
            cm.Update(c2);
            foreach (var c1 in cm.GetAll().Data)
            {
                Console.WriteLine(c1.ColorName);
            }
            Console.WriteLine("-----------------------------------------");
            cm.Delete(c2);
            foreach (var c1 in cm.GetAll().Data)
            {
                Console.WriteLine(c1.ColorName);
            }
        }
Exemplo n.º 13
0
        private static void ColorTest()
        {
            ColorManager colorManager = new ColorManager(new EfColorDal());

            colorManager.Insert(new Color {
                ColorName = "White"
            });
            Console.WriteLine("Color added.");
            colorManager.Update(new Color {
                ColorId = 1008, ColorName = "Red"
            });
            Console.WriteLine("Color updated.");
            colorManager.Delete(new Color {
                ColorId = 1008
            });
            Console.WriteLine("Color deleted.");

            Console.WriteLine("---List of Color---");

            var result = colorManager.GetAll();

            if (result.Success == true)
            {
                foreach (var color in result.Data)
                {
                    Console.WriteLine(color.ColorName);
                }
            }
            else
            {
                Console.WriteLine(result.Message);
            }
            Console.ReadLine();
        }
Exemplo n.º 14
0
        private static void ColorTest()
        {
            ColorManager colorManager = new ColorManager(new EfColorDal());
            Color        color        = new Color()
            {
                ColorId   = 5,
                ColorName = "beyaz"
            };

            colorManager.Add(color);

            Console.WriteLine("renk listesi:");
            foreach (var color1 in colorManager.GetAll().Data)
            {
                Console.WriteLine(color1.ColorName);
            }

            color.ColorName = "beyaz";
            colorManager.Update(color);

            Console.WriteLine("güncel renk listesi:");
            foreach (var color1 in colorManager.GetAll().Data)
            {
                Console.WriteLine(color1.ColorName);
            }
            colorManager.Delete(color);

            Console.WriteLine("güncel renk listesi:");
            foreach (var color1 in colorManager.GetAll().Data)
            {
                Console.WriteLine(color1.ColorName);
            }
        }
Exemplo n.º 15
0
        public static void DeleteColor(int colorID)
        {
            ColorManager ColorManager = new ColorManager(new EfColorDal());

            ColorManager.Delete(colorID);
            Console.WriteLine("Renk Silindi");
        }
Exemplo n.º 16
0
        private static void EfColorDalTest()
        {
            ColorManager colorManager = new ColorManager(new EfColorDal());

            Color color1 = new Color()
            {
                ColorName = "Aqua"
            };

            Console.WriteLine("\nInitial records of Colors table: ");
            foreach (Color color in colorManager.GetAll().Data)
            {
                Console.WriteLine(color.ColorName);
            }

            Console.WriteLine("\nAdding color: {0} to Colors table", color1.ColorName);
            colorManager.Add(color1);

            Console.WriteLine("\nList of colors: ");
            foreach (Color color in colorManager.GetAll().Data)
            {
                Console.WriteLine(color.ColorName);
            }

            Console.WriteLine("\nRemoving color: {0} from Colors table", color1.ColorName);
            colorManager.Delete(color1);

            Console.WriteLine("\nList of colors: ");
            foreach (Color color in colorManager.GetAll().Data)
            {
                Console.WriteLine(color.ColorName);
            }

            Console.WriteLine("\nColor with id 1 is: {0}", colorManager.GetById(1).Data.ColorName);
        }
Exemplo n.º 17
0
        private static void ColorTests()
        {
            ColorManager colorManager = new ColorManager(new EfColorDal());

            colorManager.Add(new Color {
                ColorName = "Black"
            });
            colorManager.Add(new Color {
                ColorName = "WHITE"
            });
            colorManager.Add(new Color {
                ColorName = "Red"
            });

            colorManager.Delete(new Color {
                ColorId = 3, ColorName = "Red"
            });

            colorManager.Update(new Color {
                ColorId = 2, ColorName = "White"
            });

            foreach (var color in colorManager.GetAll().Data)
            {
                Console.WriteLine(color.ColorName);
            }

            Console.WriteLine(colorManager.GetById(1));
        }
Exemplo n.º 18
0
        private static void ColorTest()
        {
            ColorManager colorManager = new ColorManager(new EfColorDal());

            colorManager.Insert(new Color {
                ColorName = "Dark Black"
            });
            Console.WriteLine("Yeni renk eklendi." + Environment.NewLine);
            colorManager.Delete(new Color {
                ColorId = 2
            });
            Console.WriteLine("2 Id numarali renk kayitlardan silindi." + Environment.NewLine);
            colorManager.Update(new Color {
                ColorId = 1, ColorName = "Light Blue"
            });
            Console.WriteLine("1 ID numarali renk bilgileri guncellendi");
            list();
            void list()
            {
                Console.WriteLine("Renkler listeleniyor.." + Environment.NewLine);
                foreach (var color in colorManager.GetAll().Data)
                {
                    Console.WriteLine(color.ColorId + " " + color.ColorName);
                }
            }
        }
Exemplo n.º 19
0
        private static void ColorTest()
        {
            ColorManager colorManager = new ColorManager(new EfColorDal());

            colorManager.Add(new Color {
                ColorName = "BEIGE ANTIQUE MET", ColorCode = "129"
            });
            colorManager.Update(new Color {
                ColorId = 8, ColorName = "BEIGE ANTIQUE MET", ColorCode = "129"
            });
            colorManager.Delete(new Color {
                ColorId = 2018
            });


            var result = colorManager.GetAll();

            if (result.Success == true)
            {
                foreach (var color in result.Data)
                {
                    Console.WriteLine("Aracın Rengi: " + color.ColorName + " -- Aracın Renk Kodu: " + color.ColorCode);
                }
            }
            else
            {
                Console.WriteLine(result.Message);
            }
        }
Exemplo n.º 20
0
        private static void ColorTest()
        {
            Console.WriteLine("-----------------------R E N K---------------------------");
            ColorManager colorManager = new ColorManager(new EfColorDal());

            foreach (var color in colorManager.GetAll().Data)
            {
                Console.WriteLine(color.ColorName);
            }
            Color color1 = new Color();

            color1.ColorName = "Gri";
            colorManager.Add(color1);

            Console.WriteLine("-----------------------R E N K EKLENDİ---------------------------");
            foreach (var color in colorManager.GetAll().Data)
            {
                Console.WriteLine(color.ColorName);
            }

            Console.WriteLine("-----------------------R E N K Silindi---------------------------");
            colorManager.Delete(color1);
            foreach (var color in colorManager.GetAll().Data)
            {
                Console.WriteLine(color.ColorName);
            }
            Console.WriteLine("-----------------------R E N K Güncellendi---------------------------");
            colorManager.Update(new Color {
                ColorId = 1005, ColorName = "Mavi"
            });
            foreach (var color in colorManager.GetAll().Data)
            {
                Console.WriteLine(color.ColorName);
            }
        }
        private static void DeleteColorTest()
        {
            ColorManager colorManager = new ColorManager(new EfColorDal());

            colorManager.Delete(new Color {
                ColorId = 2, ColorName = "Beyaz"
            });
        }
Exemplo n.º 22
0
        private static void colorDeleteTest()
        {
            ColorManager colorManager = new ColorManager(new EfColorDal());

            colorManager.Delete(new Color {
                ColorName = "sarı", Id = 3
            });
        }
Exemplo n.º 23
0
        private static void DeleteColorTest(int id)
        {
            ColorManager colorManager = new ColorManager(new EfColorDal());

            var result = colorManager.Delete(colorManager.GetById(id).Data);

            Console.WriteLine(result.Message);
        }
Exemplo n.º 24
0
 private static void DeleteColor(ColorManager colorManager)
 {
     colorManager.Delete(8);
     foreach (var color1 in colorManager.GetAll().Data)
     {
         Console.WriteLine(color1.ColorName);
     }
 }
Exemplo n.º 25
0
        private static void ColorDelete()
        {
            ColorManager colorManager = new ColorManager(new EfColorDal());

            colorManager.Delete(new Color {
                ColorId = 1
            });
        }
Exemplo n.º 26
0
        public static void ColorTest()
        {
            ColorManager colorManager = new ColorManager(new EfColorDal());

            colorManager.Delete(new Color {
                ColorId = 3, ColorName = " Mor "
            });
        }
Exemplo n.º 27
0
        private protected static void DeleteColorTest()
        {
            ColorManager colorManager = new ColorManager(new EfColorDal());

            colorManager.Delete(new Color {
                ColorId = 1002
            });
        }
Exemplo n.º 28
0
        private static void DeleteTest(ColorManager colorManager)
        {
            var result = colorManager.Delete(new Color {
                ID = 4
            });

            Console.WriteLine(result.Message);
        }
Exemplo n.º 29
0
        private static void RunColorManager()
        {
            ColorManager colorManager = new ColorManager(new EfColorDal());
            int          options      = -1;

            while (options != 0)
            {
                Console.WriteLine("1)List All Color\n" +
                                  "2)Get Color By ID\n" +
                                  "3)Add Color\n" +
                                  "4)Delete Color\n" +
                                  "5)Update Color\n" +
                                  "0)Exit Menu" +
                                  "");
                options = Convert.ToInt32(Console.ReadLine());
                switch (options)
                {
                case 1:
                    foreach (var color in colorManager.GetAll().Data)
                    {
                        Console.WriteLine("Color ID: {0} = {1}", color.ColorID, color.ColorName);
                    }
                    Console.WriteLine(colorManager.GetAll().Message);
                    break;

                case 2:
                    Console.WriteLine(colorManager.GetID(2).Data.ColorName);
                    break;

                case 3:
                    Console.WriteLine("-Enter Color Name-");
                    string addedColor = Console.ReadLine();
                    colorManager.Add(new Color {
                        ColorName = addedColor
                    });
                    break;

                case 4:
                    Console.WriteLine("-Enter Color ID-");
                    int deletedColor = Convert.ToInt32(Console.ReadLine());
                    colorManager.Delete(new Color {
                        ColorID = deletedColor
                    });
                    break;

                case 5:
                    Console.WriteLine("-Enter Color ID-");
                    int updatedColor = Convert.ToInt32(Console.ReadLine());
                    colorManager.Update(new Color {
                        ColorID = updatedColor, ColorName = "Sarı"
                    });
                    break;

                default:
                    break;
                }
            }
        }
Exemplo n.º 30
0
        private static void DeleteColor(ColorManager colorManager)
        {
            Color color = new Color();

            Console.WriteLine("Color Id: ");
            color.ColorId = Convert.ToInt32(Console.ReadLine());

            colorManager.Delete(color);
        }