Exemplo 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);
        }
Exemplo n.º 2
0
        private static void ColourUpdateTest()
        {
            ColourManager colourManager = new ColourManager(new EfColourDal());
            Colour        colour        = new Colour();

            colour.Id = 4;
            Console.WriteLine("Before the Update");
            Console.WriteLine();
            ColourAllTest();
            Console.WriteLine();
            colour.ColourName = "Gray";
            var result = colourManager.Update(colour);

            Console.WriteLine();
            Console.WriteLine(result.Message);
            Console.WriteLine();
            Console.WriteLine("After the Update");
            Console.WriteLine();
            ColourAllTest();
        }