Exemplo n.º 1
0
        public int IsPastryMade(bool isSavory, string shape)
        {
            int    pastryCount  = 0;
            Pastry pastryInList = MadePastry.Where(pastryPair => pastryPair.Key.IsSavory == isSavory && pastryPair.Key.Shape == shape).FirstOrDefault().Key;

            if (pastryInList != null)
            {
                pastryCount = MadePastry[pastryInList];
            }
            return(pastryCount);
        }
Exemplo n.º 2
0
 public void RemoveFromShopInventory(Product product, int count)
 {
     if (product.Type == "Bread")
     {
         Bread breadProduct = (Bread)product;
         Bread bread        = MadeBread.Where(breadPair => breadPair.Key.IsGlutenFree == breadProduct.IsGlutenFree && breadPair.Key.IsSliced == breadProduct.IsSliced).FirstOrDefault().Key;
         MadeBread[bread] -= count;
     }
     else
     {
         Pastry pastryProduct = (Pastry)product;
         Pastry pastry        = MadePastry.Where(pastryPair => pastryPair.Key.IsSavory == pastryProduct.IsSavory && pastryPair.Key.Shape == pastryProduct.Shape).FirstOrDefault().Key;
         MadePastry[pastry] -= count;
     }
 }
Exemplo n.º 3
0
        public void MakePastry(bool isSavory, string shape, int count)
        {
            Pastry pastry = new Pastry(isSavory, shape);

            Thread.Sleep(300); // baking time
            Pastry pastryInList = MadePastry.Where(pastryPair => pastryPair.Key.IsSavory == isSavory && pastryPair.Key.Shape == shape).FirstOrDefault().Key;

            if (pastryInList != null)
            {
                MadePastry[pastryInList] += count;
            }
            else
            {
                MadePastry.Add(pastry, count);
            }
        }