Пример #1
0
        private static void DecoratorPattern()
        {
            // Create book
            Book book = new Book("Worley", "Inside ASP.NET", 10);

            book.Display();

            // Create video
            Video video = new Video("Spielberg", "Jaws", 23, 92);

            video.Display();

            // Make video borrowable, then borrow and display
            Console.WriteLine("\nMaking video borrowable:");

            Borrowable borrowvideo = new Borrowable(video);

            borrowvideo.BorrowItem("Customer #1");
            borrowvideo.BorrowItem("Customer #2");

            borrowvideo.Display();

            // Wait for user
            Console.ReadKey();
        }
Пример #2
0
        static void Main(string[] args)
        {
            Book book = new Book("J.R.R Tolkien", "Yüklerin Efendisi: Yüzük Kardeşliği", 1000);

            book.Display();

            Video video = new Video("Peter Jackson", "Yüklerin Efendisi: Yüzük Kardeşliği", 228, 100);

            video.Display();


            // Make video borrowable, then borrow and display
            Console.WriteLine("\nMaking video borrowable:");


            Borrowable borrowvideo = new Borrowable(video);

            borrowvideo.BorrowItem("Customer #1");
            borrowvideo.BorrowItem("Customer #2");

            borrowvideo.Display();

            borrowvideo.ReturnItem("Customer #1");
            borrowvideo.Display();

            Console.ReadKey();
        }
Пример #3
0
        static void Main(string[] args)
        {
            //Create book
            var book = new Book("Microsoft", "Asp.Net Core", 10);

            book.Display();

            //Create video
            var video = new Video(".Net conference", "Blazor", 120, 22);

            video.Display();

            Console.WriteLine("\nMaking video borrowable.");

            var borrowableVideo = new Borrowable(video);

            borrowableVideo.BorrowItem("Atanas Vasilev");
            borrowableVideo.BorrowItem("Pesho Georgiev");

            borrowableVideo.Display();

            borrowableVideo.ReturnItem("Atanas Vasilev");

            Console.WriteLine("\nAtanas Vasilev returned the video.");
            borrowableVideo.Display();
        }
Пример #4
0
        static void Main(string[] args)
        {
            Console.WriteLine("Vehiculo \n");

            Vehiculo monovolumen = new Monovolumen();
            Vehiculo berlina     = new Berlina();

            monovolumen = new Gasolina(monovolumen);

            MostrarCaracteristicas(monovolumen);
            MostrarCaracteristicas(berlina);


            Console.WriteLine("\n Libreria");

            // Create book

            Book book = new Book("Worley", "Inside ASP.NET", 10);

            book.Display();

            // Create video

            Video video = new Video("Spielberg", "Jaws", 23, 92);

            video.Display();

            // Make video borrowable, then borrow and display

            Console.WriteLine("\nMaking video borrowable:");

            Borrowable borrowvideo = new Borrowable(video);

            borrowvideo.BorrowItem("Customer #1");
            borrowvideo.BorrowItem("Customer #2");

            borrowvideo.Display();

            Console.ReadKey();
        }
Пример #5
0
        static void Main(string[] args)
        {
            // Create book
            Book book = new Book("Worley", "Inside ASP.NET", 10);

            book.Display();

            // Create video
            Video video = new Video("Spielberg", "Jaws", 23, 92);

            video.Display();

            //Create audio tape
            AudioTape audioTape = new AudioTape("Morgan Freeman", "The Wish Giver", "Bill Brittain", 24, 600);

            audioTape.Display();

            // Make video borrowable, then borrow and display
            Console.WriteLine("\nMaking video rentable:");

            Rentable rentedVideo = new Rentable(video);

            rentedVideo.RentItem("Customer #1");
            rentedVideo.RentItem("Customer #2");

            rentedVideo.Display();

            Console.WriteLine("\nMaking audio tape reservable");

            Reservable reservedAudioTape = new Reservable(audioTape);

            reservedAudioTape.ReserveItem("Customer #3");
            reservedAudioTape.ReserveItem("Customer #4");

            reservedAudioTape.Display();

            // Wait for user
            Console.ReadKey();
        }
Пример #6
0
        /// <summary>
        /// Entry point into console application.
        /// </summary>
        public static void Main()
        {
            // Create book
            Book book = new Book("Worley", "Inside ASP.NET", 10);

            book.Display();

            // Create video
            Video video = new Video("Spielberg", "Jaws", 23, 92);

            video.Display();

            // Make video borrowable, then borrow and display
            Console.WriteLine("\nMaking video borrowable:");

            Rentable borrowvideo = new Rentable(video);

            borrowvideo.BorrowItem("Customer #1");
            borrowvideo.BorrowItem("Customer #2");
            borrowvideo.Display();

            // Wait for user
            Console.ReadKey();
        }