Beispiel #1
0
        /// <summary>
        /// Converts y/n to boolean based on user input,
        /// if true program will continue to add products - DONE
        /// </summary>
        /// <returns>boolean</returns>
        public bool IsAddAnotherProduct()
        {
            Console.WriteLine("Do you want to add another Product?(Y/N)");

            var input = Console.ReadLine().Trim();

            while (!(input != string.Empty &&
                     input.Equals("y", StringComparison.OrdinalIgnoreCase) ||
                     input.Equals("n", StringComparison.OrdinalIgnoreCase)))
            {
                Console.WriteLine("Invalid input. Enter (Y/N)");
                input = Console.ReadLine();
            }

            bool addAnotherProduct = TaxHelper.ParseBoolean(input);

            System.Diagnostics.Debug.WriteLine($"Here is your bool value: {addAnotherProduct}");
            return(addAnotherProduct);
        }