Ejemplo n.º 1
0
        private static void ColourTest()
        {
            ColourManager colourManager = new ColourManager(new EfColourDal());

            foreach (var colour in colourManager.GetAll())
            {
                Console.WriteLine(colour.ColourName + "/" + colour.ColourId);
            }

            foreach (var colour in colourManager.GetById(3))
            {
                Console.WriteLine(colour.ColourId + "/" + colour.ColourName);
            }

            Colour colourAdd = new Colour()
            {
                ColourName = "Dark Blue"
            };

            colourManager.Add(colourAdd);

            foreach (var colour in colourManager.GetAll())
            {
                Console.WriteLine(colour.ColourName + "/" + colour.ColourId);
            }

            colourManager.Delete(2002);
            foreach (var colours in colourManager.GetAll())
            {
                Console.WriteLine(colours.ColourName);
            }

            colourManager.Update(1);
        }
Ejemplo n.º 2
0
        private static void ColourAddTest()
        {
            Colour colour = new Colour();

            colour.Id         = 7;
            colour.ColourName = "Purple";
            ColourManager colourManager = new ColourManager(new EfColourDal());
            var           result        = colourManager.Add(colour);

            Console.WriteLine(result.Message);
            Console.WriteLine();
            ColourAllTest();
        }
Ejemplo n.º 3
0
        private static void ColourDeleteTest()
        {
            ColourManager colourManager = new ColourManager(new EfColourDal());
            Colour        colour        = new Colour();

            colour.Id         = 8;
            colour.ColourName = "Green";
            colourManager.Add(colour);
            Console.WriteLine("Duplicate added for test");
            Console.WriteLine();
            ColourAllTest();
            Console.WriteLine();
            var result = colourManager.Delete(colour);

            Console.WriteLine(result.Message);
            Console.WriteLine();
            Console.WriteLine("Duplicate removed");
            Console.WriteLine();
            ColourAllTest();
        }