public CatalogViewModel(ShoppingCart cart, IEnumerable<string> categories, IEnumerable<Product> products) { TotalItemsInCart = cart.Items.Count(); TotalCartValue = cart.Total; Categories = categories; CategoryProducts = products.Select(product => new ProductViewModel(product)); }
public ShoppingCartViewModel(ShoppingCart cart, IEnumerable<string> categories) { Categories = categories; ItemsCount = cart.Items.Count(); TotalAmount = cart.Total; Items = cart.Items.Select(item => new ShoppingCartItemViewModel(item)).ToList(); }
ShoppingCart CreateCart() { var cart = new ShoppingCart(); _shoppingCartRepository.Add(cart); return cart; }
public ShoppingCartItem(ShoppingCart shoppingCart) { _shoppingCart = shoppingCart; }