Esempio n. 1
0
        /// <summary>
        /// This lists the payment method changing method.
        /// </summary>
        /// <param name="shopLogic">Logic for Orders repository and SkiEqupments repository.</param>
        public static void ChangePayment(ShopLogic shopLogic)
        {
            int  id    = IntParse(Enter.ToString());
            bool valid = false;

            try
            {
                shopLogic?.GetOrderById(id);
                valid = true;
            }
            catch (ArgumentException)
            {
                Console.WriteLine(Other.ToString());
            }

            if (valid)
            {
                Console.WriteLine(Selected.ToString());

                Console.WriteLine(shopLogic?.GetOrderById(id).ToString());
                Console.WriteLine(PressEnter.ToString());
                valid = false;
                string payment = string.Empty;
                do
                {
                    const string Npm = "Enter new payment method here: (Credit Card/PayPal)";
                    payment = Console.ReadLine();
                    Console.WriteLine(Npm.ToString());
                    if (payment == "Credit Card" || payment == "PayPal")
                    {
                        valid = true;
                    }
                }while (!valid);

                shopLogic?.ChangePayment(id, payment);

                Console.WriteLine(Saved.ToString());
            }

            Console.ReadLine();
        }