예제 #1
0
 /// <summary>
 /// Calculate total price of all someProducts in the store.
 /// </summary>
 /// <param name="someProduct"></param>
 /// <returns>Total price, $.</returns>
 public double GetTotalPrice(StorageUnit someProduct)
 {
     if (someProduct != null)
     {
         return(someProduct.Product.Price * someProduct.Number);
     }
     else
     {
         throw new ArgumentNullException();
     }
 }
예제 #2
0
        /// <summary>
        /// Add new product to the storage.
        /// </summary>
        /// <param name="product">Product.</param>
        /// <param name="number">Number of products.</param>
        public void AddProduct(Product product, int number)
        {
            StorageUnit newUnit = new StorageUnit(product, number);

            Storage.Add(newUnit);
        }