Exemple #1
0
        public string EditProductType()
        {
            bool isValid = false;
            ProductTypeResponse response = new ProductTypeResponse();
            string userType = "";

            //display options
            io.DisplayProducts(manager.ProductList());

            while (isValid == false)
            {
                userType = io.GetStringFromUser("Please select product type or press enter to skip: ");
                if (userType == "")
                {
                    return(userType);
                }
                //check if this product is an option on list
                response = manager.ProductType(userType);

                if (response.Success)
                {
                    isValid = true;
                }
                else
                {
                    Console.WriteLine("The selected product type is not available.");
                }
            }

            return(response.Product.ProductType);
        }
Exemple #2
0
        private void NewOrderProduct()
        {
            bool isValidProduct = false;

            while (isValidProduct == false) //add ignore case in validation
            {
                //display product options
                io.DisplayProducts(manager.ProductList());
                //get product type string and check list for match
                string userType = io.GetStringFromUser("Please select product type: ");
                productResponse = manager.ProductType(userType);

                if (productResponse.Success)
                {
                    isValidProduct = true;
                }
                else
                {
                    Console.WriteLine("The selected product type is not available.");
                }
            }
        }