示例#1
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);
        }
示例#2
0
 public IActionResult Confirmation(int accountID)
 {
     shopLogic.CreateOrder(accountID);
     shopLogic.DeleteBag(accountID);
     return(View());
 }