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

            bool valid = false;

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

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

                Console.WriteLine(shopLogic?.GetOrderById(id).ToString());
            }

            Console.ReadLine();
        }
Esempio n. 2
0
        /// <summary>
        /// This is the order eraser menu method.
        /// </summary>
        /// <param name="shopLogic">Logic for Orders repository and SkiEqupments repository.</param>
        public static void DeleteOrder(ShopLogic shopLogic)
        {
            int  id    = IntParse(Enter.ToString());
            bool valid = false;

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

            if (valid)
            {
                bool exists = shopLogic.DeleteOrder(id);
                if (exists)
                {
                    string print = "Entity deleted.";
                    Console.WriteLine(print.ToString());
                }
                else
                {
                    Console.WriteLine(Other.ToString());
                    id = IntParse(Enter.ToString());
                }
            }

            Console.ReadLine();
        }
Esempio n. 3
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();
        }