示例#1
0
        public static void PickUser(CandyStorage db)
        {
            var users = db.allTheUsers();

            Console.WriteLine("Here are your users");

            foreach (var user in users)
            {
                Console.WriteLine($"{user.userName}");
            }
            Console.ReadLine();

            Console.WriteLine("Which user would you like to use?:");
            var userChoice = Console.ReadLine();
            var userIfound = users.Where(user => user.userName == userChoice).Single();

            Console.WriteLine($"Here are the candies for {userChoice}: ");

            var candies = db.getOwnersCandy(userIfound.Id);

            foreach (var candy in candies)
            {
                Console.WriteLine($"{candy.Name}");
            }

            Console.ReadLine();

            var userInput = MainMenu();
            var exit      = false;

            exit = TakeActions(db, userInput);
        }