public MiniBasketRefreshViewModel Refresh() { var viewModel = new MiniBasketRefreshViewModel { IsEmpty = true }; if (!_transactionLibraryInternal.HasBasket()) { return(viewModel); } var purchaseOrder = _transactionLibraryInternal.GetBasket(false).PurchaseOrder; var quantity = purchaseOrder.OrderLines.Sum(x => x.Quantity); var total = purchaseOrder.OrderTotal.HasValue ? new Money(purchaseOrder.OrderTotal.Value, purchaseOrder.BillingCurrency) : new Money(0, purchaseOrder.BillingCurrency); viewModel.NumberOfItems = quantity.ToString(); viewModel.IsEmpty = quantity == 0; viewModel.Total = total.ToString(); return(viewModel); }
public virtual MiniBasketRefreshViewModel Refresh() { var viewModel = new MiniBasketRefreshViewModel { IsEmpty = true }; if (!TransactionLibrary.HasBasket()) { return(viewModel); } var purchaseOrder = TransactionLibrary.GetBasket(false); viewModel.OrderLines = CartModel.GetOrderLineList(purchaseOrder, this.productDetailsPageId); var quantity = purchaseOrder.OrderLines.Sum(x => x.Quantity); var total = purchaseOrder.OrderTotal.HasValue ? new Money(purchaseOrder.OrderTotal.Value, purchaseOrder.BillingCurrency.ISOCode) : new Money(0, purchaseOrder.BillingCurrency.ISOCode); viewModel.NumberOfItems = quantity.ToString(); viewModel.IsEmpty = quantity == 0; viewModel.Total = total.ToString(); viewModel.CartPageUrl = GetPageAbsoluteUrl(cartPageId); viewModel.CheckoutPageUrl = GetPageAbsoluteUrl(this.checkoutPageId); return(viewModel); }