Пример #1
0
        // aUser
        public static bool saveProduct(string username, string storeName, string manufacturer, Dictionary <string, int> product)
        {
            aUser temp = getUser(username);

            if (temp == null)
            {
                return(false);
            }
            Store store = browseStore(username, storeName);

            if (store == null)
            {
                return(false);
            }
            ShoppingBasket basket = new ShoppingBasket(store, temp);

            foreach (string pName in product.Keys)
            {
                Product p1 = Stores.searchStore(storeName).searchProduct(pName, manufacturer);
                p1.amount = product[pName];
                basket.addProduct(p1);
            }

            return(temp.saveProduct(basket));
        }