public void Merge(IEnumerable <dynamic> carts) { foreach (var cart in carts) { if (cart.Customer != null) { Customer = new ShoppingCartCustomer { Id = cart.Customer.Id, Name = cart.Customer.Name }; } if (cart.Items != null) { foreach (var item in cart.Items) { decimal price = (decimal)item.Product.Price; int quantity = item.Quantity; AddToCart(item.Product.Id, item.Product.Name, price, quantity); } } } }
public void Merge(IEnumerable<dynamic> carts) { foreach (var cart in carts) { if(cart.Customer != null) { Customer = new ShoppingCartCustomer { Id = cart.Customer.Id, Name = cart.Customer.Name }; } if(cart.Items != null) { foreach (var item in cart.Items) { decimal price = (decimal)item.Product.Price; int quantity = item.Quantity; AddToCart(item.Product.Id, item.Product.Name, price, quantity); } } } }