コード例 #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);
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: ugurmert/ReCapProject
        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);
            }
        }
コード例 #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("-------");
        }
コード例 #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();
        }
コード例 #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);
        }
コード例 #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);
            }
        }
コード例 #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);
            }
        }
コード例 #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);
            }
        }
コード例 #9
0
ファイル: Program.cs プロジェクト: ykizilirmak/ReCapProject
        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);
            }
        }
コード例 #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);
            //}
        }
コード例 #11
0
ファイル: Program.cs プロジェクト: furkanartar/CarRental
        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
            });
        }
コード例 #12
0
ファイル: Program.cs プロジェクト: ebruky/RentCarProject
        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);
            }
        }
コード例 #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();
        }
コード例 #14
0
ファイル: Program.cs プロジェクト: zeynepsl/ReCapProject
        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);
            }
        }
コード例 #15
0
        public static void DeleteColor(int colorID)
        {
            ColorManager ColorManager = new ColorManager(new EfColorDal());

            ColorManager.Delete(colorID);
            Console.WriteLine("Renk Silindi");
        }
コード例 #16
0
ファイル: Program.cs プロジェクト: WowDogeCode/NET-Recap
        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);
        }
コード例 #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));
        }
コード例 #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);
                }
            }
        }
コード例 #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);
            }
        }
コード例 #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);
            }
        }
コード例 #21
0
        private static void DeleteColorTest()
        {
            ColorManager colorManager = new ColorManager(new EfColorDal());

            colorManager.Delete(new Color {
                ColorId = 2, ColorName = "Beyaz"
            });
        }
コード例 #22
0
        private static void colorDeleteTest()
        {
            ColorManager colorManager = new ColorManager(new EfColorDal());

            colorManager.Delete(new Color {
                ColorName = "sarı", Id = 3
            });
        }
コード例 #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);
        }
コード例 #24
0
 private static void DeleteColor(ColorManager colorManager)
 {
     colorManager.Delete(8);
     foreach (var color1 in colorManager.GetAll().Data)
     {
         Console.WriteLine(color1.ColorName);
     }
 }
コード例 #25
0
        private static void ColorDelete()
        {
            ColorManager colorManager = new ColorManager(new EfColorDal());

            colorManager.Delete(new Color {
                ColorId = 1
            });
        }
コード例 #26
0
        public static void ColorTest()
        {
            ColorManager colorManager = new ColorManager(new EfColorDal());

            colorManager.Delete(new Color {
                ColorId = 3, ColorName = " Mor "
            });
        }
コード例 #27
0
        private protected static void DeleteColorTest()
        {
            ColorManager colorManager = new ColorManager(new EfColorDal());

            colorManager.Delete(new Color {
                ColorId = 1002
            });
        }
コード例 #28
0
        private static void DeleteTest(ColorManager colorManager)
        {
            var result = colorManager.Delete(new Color {
                ID = 4
            });

            Console.WriteLine(result.Message);
        }
コード例 #29
0
ファイル: Program.cs プロジェクト: BayBaris/ReCapProject
        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;
                }
            }
        }
コード例 #30
0
ファイル: Program.cs プロジェクト: fatmakart/CarRentProject
        private static void DeleteColor(ColorManager colorManager)
        {
            Color color = new Color();

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

            colorManager.Delete(color);
        }