예제 #1
0
        public void ListProducts(int categoryId, string category)
        {
            Clear();
            var productsRepository = new ProductsRepository();

            var products = productsRepository.GetProductsByCategory(categoryId);

            Console.WriteLine("Liste des produits de la catégorie : " + category + "\n");

            var productBrowser = new ProductBrowser();

            productBrowser.BrowseListOfProducts(products);
        }
예제 #2
0
        public Product ListProducts(int categoryId, string category)
        {
            Clear();
            var productsRepository = new ProductsRepository();

            var products = productsRepository.GetProductsByCategory(categoryId);

            Console.WriteLine("Liste des produits de la catégorie : " + category + "\n");

            var productBrowser = new ProductBrowser();
            var result         = productBrowser.SelectFromListOfProductsByCategory(products);

            switch (result.Key)
            {
            case "product":
                return((Product)result.Value);

            case "action":
                switch (result.Value)
                {
                case "categories":
                    return(SelectProductByCategory());

                case "quit":
                    return(null);

                default:
                    return(null);
                }
                break;

            default:
                Clear();
                Echo("Une erreur est survenue");
                AskKeyPress();
                return(DisplayMainMenuWithProduct());
            }
        }