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
        public void AddProd(Product Product, int Ammount)
        {
            CartProduct cartProduct = new CartProduct {
                Product = Product, Ammount = Ammount
            };

            CartProducts.Add(cartProduct);
            CartProducts.Add(cartProduct);
            CartProducts.Add(cartProduct);
        }
Ejemplo n.º 3
0
 public void AddItemsToCart(List <char> productIds)
 {
     foreach (char item in productIds)
     {
         var existingItem = CartProducts.SingleOrDefault(x => x.ProductId == item);
         if (existingItem != null)
         {
             existingItem.Quantity++;
         }
         else
         {
             CartProducts.Add(new CartProduct()
             {
                 ProductId = item, Quantity = 1
             });
         }
     }
 }
Ejemplo n.º 4
0
 public void AddItem(Product product, decimal Quantity)
 {
     CartProducts.Add(new CartProduct {
         Product = product, Quantity = Quantity
     });
 }