public void AddToBasket(int customerId, int productId) { var currentBasket = _basket.GetBasket(customerId); if (currentBasket == null) { currentBasket = new BasketWithGoods { CustomerId = customerId, ProductIds = new List <int>(productId) }; _basket.AddToBasket(currentBasket); } else { currentBasket.Quantity = productId; //add number of elements to the list } //productId is not added to the list of all prods! currentBasket.ProductIds.Add(productId); }
public void AddToBasket(BasketWithGoods basket) { _basket.Add(basket); }