public CartViewModel GetCartViewModelByCustomerId(string customerId) { var cartViewModel = new CartViewModel(); Cart cart = this.GetCartEntityByCustomerId(customerId); if (cart != null) { cartViewModel.Items = _itemService .AllViewModelsByCartIdAsync(cart.Id).ToList(); } if (cartViewModel.Items != null) { foreach (var item in cartViewModel.Items) { cartViewModel.Price += (item.Product.Price * item.ProductQuantity); } } return(cartViewModel); }