Example #1
0
 public bool checkIngredient(Ingredients name)
 {
     foreach (var item in Dictionary.Keys)
     {
         if (item.Name.Equals(name.Name))
         {
             if (Dictionary[item] == 0)
             {
                 return(false);
             }
             Dictionary[item]--;
             return(true);
         }
     }
     return(false);
 }
Example #2
0
        public void addIngredient(Ingredients ingredients)
        {
            bool contains = false;

            foreach (var item in Dictionary.Keys)
            {
                if (item.Name.Equals(ingredients.Name))
                {
                    contains = true;
                    Dictionary[item]++;
                }
            }
            if (!contains)
            {
                Dictionary.Add(ingredients, 1);
            }
            Memento.Add(new Memento(Dictionary));
        }