/// <summary>
        /// Creates the compare model.
        /// </summary>
        /// <param name="cartHelper">The cart helper.</param>
        /// <returns>CompareListModel.</returns>
        public static CompareListModel CreateCompareModel(this CartHelper cartHelper)
        {
            var lineItemModels = new LineItemModel[0];
            var items = CartHelper.CatalogClient.GetItems(cartHelper.LineItems.Select(li => li.CatalogItemId).ToArray());

            if (items != null)
            {
                lineItemModels = cartHelper.LineItems.Join(items, li => li.CatalogItemId, i => i.ItemId,
                                                               (li, item) =>
                                                               new LineItemModel(li, item,
                                                                                 CartHelper.CatalogClient.GetItem(li.ParentCatalogItemId), cartHelper.Cart.BillingCurrency)).ToArray();
            }

            return new CompareListModel(lineItemModels);
        }
Esempio n. 2
0
		/// <summary>
		/// Initializes a new instance of the <see cref="CompareListModel"/> class.
		/// </summary>
		/// <param name="items">The items.</param>
        public CompareListModel(LineItemModel[] items)
        {
            _lineItems = items;

		    if (items != null)
		    {

		        _availableProperties = items.SelectMany(x => x.CatalogItem.Properties)
		                                    .OrderBy(x => x.Priority)
		                                    .GroupBy(x => x.Name).ToArray();
		    }
        }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OrderReturnItem"/> class.
 /// </summary>
 /// <param name="lineItem">The line item.</param>
 public OrderReturnItem(LineItemModel lineItem) : this()
 {
     LineItemModel = lineItem;
     MaxQty        = (int)lineItem.LineItem.Quantity;
 }
Esempio n. 4
0
		/// <summary>
		/// Initializes a new instance of the <see cref="OrderReturnItem"/> class.
		/// </summary>
		/// <param name="lineItem">The line item.</param>
        public OrderReturnItem(LineItemModel lineItem) : this()
        {
            LineItemModel = lineItem;
            MaxQty = (int)lineItem.LineItem.Quantity;
        }