Esempio n. 1
0
 public bool ChangeStock(Merchandise merch, int amount)
 {
     foreach (KeyValuePair <Merchandise, int> item in iven)
     {
         if (item.Key == merch)
         {
             if (item.Value + amount > 0)
             {
                 iven[merch] = item.Value + amount;
                 return(true);
             }
             else
             {
                 Console.WriteLine($"I got your item, but I only got {item.Value} left");
                 return(false);
             }
         }
     }
     Console.WriteLine("I dont have that in stock");
     return(false);
 }
Esempio n. 2
0
 public bool AdjustQuantity(Merchandise merch, int quantity)
 {
     foreach (KeyValuePair <Merchandise, int> item in details)
     {
         if (item.Key.MerchID == merch.MerchID)
         {
             if (item.Value + quantity >= 0)
             {
                 details[item.Key] = item.Value + quantity;
                 return(true);
             }
             else
             {
                 Console.WriteLine($"Product found, but only {item.Value} in order. You tried to take {-1 * quantity} amount. Please try again.");
                 return(false);
             }
         }
     }
     //when item is not found in inventory
     Console.WriteLine("Product not found in this Store's inventory.");
     return(false);
 }