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); }
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()); } }