예제 #1
0
        /// <summary>
        /// Run controller
        /// </summary>
        public void RunController()
        {
            var stack = new UserStack <Vehicle>(16);

            _outputService.ShowVehicleEnumerable(stack);
            var counter = 1;

            foreach (var vehicle in _context.UserCollection.Vehicles)
            {
                _outputService.ShowStringWithLineBreak($"{counter++}. {vehicle.ModelName} заехало в гараж");
                stack.Push(vehicle);
            }

            counter--;
            while (stack.Count != 0)
            {
                _outputService.ShowStringWithLineBreak($"{counter--}. {stack.Pop().ModelName} выехало из гаража");
            }
        }