Beispiel #1
0
        private static void AddStockToStore()
        {
            var checkForStores = Exists(_stores.StoreList);

            if (checkForStores)
            {
                var matchList = SearchByNameStore();

                Console.WriteLine("Please use the number keys to make your selection");

                var storeSelectionInt = GetUserInputInt(_stores.StoreList.Count, 1);
                var checkForProducts  = Exists(_products.ProductList);

                if (checkForProducts)
                {
                    Console.WriteLine("Choose Product to add to store");
                    ListItems(_products.ProductList);
                    var productSelectionInt = GetUserInputInt(_products.ProductList.Count, 1);

                    if (matchList[storeSelectionInt - 1].StockedProducts
                        .Contains(_products.ProductList[productSelectionInt - 1]))
                    {
                        Console.WriteLine("Product already stocked at store.");
                    }
                    else
                    {
                        _stores.AddProductToStore(matchList[storeSelectionInt - 1],
                                                  _products.ProductList[productSelectionInt - 1]);

                        Console.WriteLine("Product Added");
                    }
                }
            }

            Enter();
        }