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));
        }
示例#2
0
 public OrderTablePage()
 {
     InitializeComponent();
     Items          = LineItem.GetSampleData();
     BindingContext = viewModel = new LineItemsViewModel();
 }