Ejemplo n.º 1
0
        static void PhysicalReg()
        {
            Console.WriteLine("Physical Product Registration: ");
            Console.WriteLine("Name: ");
            string name = Console.ReadLine();

            Console.WriteLine("Price: ");
            float price = float.Parse(Console.ReadLine());

            Console.WriteLine("Shipment: ");
            float shipment = float.Parse(Console.ReadLine());

            PhysicalProduct fp = new PhysicalProduct(name, price, shipment);

            products.Add(fp);
            Save();
        }
Ejemplo n.º 2
0
        static void Register()
        {
            Console.WriteLine("=== Product Registration: ===");
            Console.WriteLine("1-Physical Products\n2-Ebook\n3-Course");
            int ProdOption = int.Parse(Console.ReadLine());

            switch (ProdOption)
            {
            case 1:
                PhyscProdRegister();
                break;

            case 2:
                EbookRegister();
                break;

            case 3:
                CourserRegister();
                break;
            }

            void PhyscProdRegister()
            {
                Console.WriteLine("=== Registering Physical Product ===");
                Console.WriteLine("Name: ");
                string name = Console.ReadLine();

                Console.WriteLine("Price: ");
                float price = float.Parse(Console.ReadLine());

                Console.WriteLine("Delivery Cost: ");
                float           shipping  = float.Parse(Console.ReadLine());
                PhysicalProduct physcProd = new PhysicalProduct(name, price, shipping);

                products.Add(physcProd);
                Save();
            }

            void EbookRegister()
            {
                Console.WriteLine("=== Registering Ebook ===");
                Console.WriteLine("Name: ");
                string name = Console.ReadLine();

                Console.WriteLine("Price: ");
                float price = float.Parse(Console.ReadLine());

                Console.WriteLine("Author: ");
                string author = Console.ReadLine();
                Ebook  ebk    = new Ebook(name, price, author);

                products.Add(ebk);
                Save();
            }

            void CourserRegister()
            {
                Console.WriteLine("=== Registering Ebook ===");
                Console.WriteLine("Name: ");
                string name = Console.ReadLine();

                Console.WriteLine("Price: ");
                float price = float.Parse(Console.ReadLine());

                Console.WriteLine("Author: ");
                string author = Console.ReadLine();

                Console.WriteLine("Slots: ");
                Course course = new Course(name, price, author);

                products.Add(course);
                Save();
            }
        }