Example #1
0
        public static void AddNewProducts(Store store, Product product)
        {
            Console.WriteLine("Enter product id:");
            int product_id = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Enter product name:");
            string product_name = Console.ReadLine();

            Console.WriteLine("Enter product price:");
            int product_price = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Enter product category:");
            string product_category = Console.ReadLine();

            Console.WriteLine("Enter brand name:");
            string brand_name = Console.ReadLine();

            Product p     = new Product(product_id, product_name, product_price, product_category);
            int     check = p.AddNewProduct(brand_name, store);

            if (check == 1)
            {
                Console.WriteLine("Product is added successfully");
            }
            else if (check == -1)
            {
                Console.WriteLine("This brand does not exist !!!");
            }
            if (check == 0)
            {
                Console.WriteLine("Product id already exists !!!");
            }
        }