Пример #1
0
        /// <summary>
        /// This method lists all the Orders.
        /// </summary>
        /// <param name="shopL">Logic for Orders repository and SkiEqupments repository.</param>
        public static void ListAllO(ShopLogic shopL)
        {
            const string value = "\n:: ALL Orders ::\n";

            Console.WriteLine(value.ToString());
            shopL?.GetAllOrders()
            .ToList()
            .ForEach(x => Console.WriteLine(x.ToString()));

            Console.ReadLine();
        }
Пример #2
0
        /// <summary>
        /// It asks about order datas.
        /// </summary>
        /// <param name="shop">Logic for Orders repository and SkiEqupments repository.</param>
        public static void InsterOrder(ShopLogic shop)
        {
            shop?.GetAllOrders().ToList().ForEach(x => Console.WriteLine(x));

            string payment = string.Empty;

            do
            {
                ToConsole("\nEnter payment:");
                payment = Console.ReadLine();
            }while (payment == "Credit Card" || payment == "PayPal");

            DateTime firstdate = DateParse("\nEnter first date:");
            DateTime lastdate  = DateParse("\nEnter last date:");
            int      promotion = IntParse("\nEnter promotion:");
            string   validS    = string.Empty;
            bool     valid     = false;

            do
            {
                ToConsole("\nEnter payment status: (y/n)");
                validS = Console.ReadLine();
            }while (validS != "y" & validS != "n");
            if (validS == "y")
            {
                valid = true;
            }

            int customerID = IntParse("\nEnter customer's ID: ");

            shop?.CreateOrder(new Data.Order()
            {
                CustomerId = customerID, Payment = payment, FirstDate = firstdate, LastDate = lastdate, Promotion = promotion, CustomerPaid = valid
            });
            ToConsole("\nNew order successfully created!");
            ListAllO(shop);
        }