예제 #1
0
        private static int GetNumberRecipe(RecipeController recipeController, int numberSelectedCategory)
        {
            List <Recipe> recipesCategory = recipeController.GetSelectedRecipes(numberSelectedCategory);
            int           numberSelectedCRecipe;

            do
            {
                Console.Write("Выберете рецепт: ");
                while (!int.TryParse(Console.ReadLine(), out numberSelectedCRecipe))
                {
                    Console.WriteLine("Не корректный выбор (введите число)");
                    Console.Write("Повторите выбор: ");
                }
            } while (numberSelectedCRecipe > recipesCategory.Count);
            return(numberSelectedCRecipe);
        }