示例#1
0
        /// <summary>
        /// This method lists all the Ski equipments.
        /// </summary>
        /// <param name="shopL">Logic for Orders repository and SkiEqupments repository.</param>
        public static void ListAllS(ShopLogic shopL)
        {
            const string value = "\n:: ALL Equipments ::\n";

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

            Console.ReadLine();
        }
示例#2
0
        /// <summary>
        /// It asks about equipment datas.
        /// </summary>
        /// <param name="shop">Logic for Orders repository and SkiEqupments repository.</param>
        public static void InsterEquipment(ShopLogic shop)
        {
            shop?.GetAllSkiEquipments().ToList().ForEach(x => Console.WriteLine(x));

            int orderID = IntParse("\nEnter order's ID: ");

            string name = string.Empty;

            do
            {
                ToConsole("\nEnter name: ");
                name = Console.ReadLine();
            }while (name == null);

            string manufacturer = string.Empty;

            do
            {
                ToConsole("\nEnter manufacturer: ");
                manufacturer = Console.ReadLine();
            }while (manufacturer == null);

            string difficulty = string.Empty;

            do
            {
                ToConsole("\nEnter difficulty: (beginner / advanced / pro)");
                difficulty = Console.ReadLine();
            }while (difficulty == null);

            int    price  = IntParse("\nEnter price:");
            int    size   = IntParse("\nEnter size:");
            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;
            }

            shop?.CreateEquipment(new Data.SkiEquipments()
            {
                OrderId = orderID, Name = name, Manufacturer = manufacturer, Difficulty = difficulty, Price = price, Size = size, Status = valid
            });
        }