public ActionResult Index(ShoppingCartPage currentPage) { var shoppingCart = _cartRepository.LoadCart(true); var lineItems = new LineItemsViewModel(new System.Collections.Generic.List <ShoppingCartLineItemViewModel>()); foreach (ILineItem lineitem in shoppingCart.LineItems) { var contentLoader = ServiceLocator.Current.GetInstance <IContentLoader>(); var referenceConverter = ServiceLocator.Current.GetInstance <ReferenceConverter>(); var variantLink = referenceConverter.GetContentLink(lineitem.Code); var variant = contentLoader.Get <GenericVariant>(variantLink); var shoppingCartLineItemViewModel = new ShoppingCartLineItemViewModel(variant.DisplayName, lineitem.PlacedPrice, lineitem.PlacedPrice.ToString("0.00") + '$', variant.Color, variant.Size, variant.GetImages().FirstOrDefault(), lineitem.Quantity, lineitem.Code); lineItems.Items.Add(shoppingCartLineItemViewModel); } lineItems.shoppingCartPage = currentPage; lineItems.Price = shoppingCart.Total.Amount.ToString("0.00") + '$'; return(View(lineItems)); }
public OrderTablePage() { InitializeComponent(); Items = LineItem.GetSampleData(); BindingContext = viewModel = new LineItemsViewModel(); }