Пример #1
0
        /// <summary>
        /// This is the order eraser menu method.
        /// </summary>
        /// <param name="shopLogic">Logic for Orders repository and SkiEqupments repository.</param>
        public static void DeleteEquipment(ShopLogic shopLogic)
        {
            int  id    = IntParse(Enter.ToString());
            bool valid = false;

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

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

            Console.ReadLine();
        }