Ejemplo n.º 1
0
        private void AppManagerOnProductCartListUpdated(object sender, ProductCartListUpdatedArgs productsInCartUpdated)
        {
            var updatedProductsList = productsInCartUpdated.ListProductsInCart.ToList();

            if (CartProducts.Count() < updatedProductsList.Count)
            {
                updatedProductsList.ForEach(item =>
                {
                    if (!CartProducts.Contains(item))
                    {
                        CartProducts.Add(item);
                    }
                });
            }
            else
            {
                CartProducts.ToList().ForEach((product) =>
                {
                    if (!updatedProductsList.Contains(product))
                    {
                        CartProducts.Remove(product);
                    }
                });
            }
        }
Ejemplo n.º 2
0
 private bool CheckAddProduct()
 {
     if (QuantityOfProduct > 0)
     {
         if (!CartProducts.Contains(SelctedProduct))
         {
             return(true);
         }
         else
         {
             MessageBox.Show("Item already in the cart");
             return(false);
         }
     }
     else
     {
         MessageBox.Show("You must enter quantity and positive number");
     }
     return(true);
 }