本文整理汇总了C#中LineItem.InjectFrom方法的典型用法代码示例。如果您正苦于以下问题:C# LineItem.InjectFrom方法的具体用法?C# LineItem.InjectFrom怎么用?C# LineItem.InjectFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LineItem
的用法示例。
在下文中一共展示了LineItem.InjectFrom方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToCoreModel
public static LineItem ToCoreModel(this LineItemEntity entity)
{
if (entity == null)
throw new ArgumentNullException("entity");
var retVal = new LineItem();
retVal.InjectFrom(entity);
retVal.Currency = (CurrencyCodes)Enum.Parse(typeof(CurrencyCodes), entity.Currency);
if (entity.Discounts != null && entity.Discounts.Any())
{
retVal.Discount = entity.Discounts.First().ToCoreModel();
}
retVal.TaxDetails = entity.TaxDetails.Select(x => x.ToCoreModel()).ToList();
return retVal;
}
示例2: ToOrderCoreModel
public static LineItem ToOrderCoreModel(this cartCoreModel.LineItem lineItem)
{
if (lineItem == null)
throw new ArgumentNullException("lineItem");
var retVal = new LineItem();
retVal.InjectFrom(lineItem);
retVal.IsGift = lineItem.IsGift;
retVal.BasePrice = lineItem.ListPrice;
retVal.Price = lineItem.PlacedPrice;
retVal.Tax = lineItem.TaxTotal;
retVal.FulfillmentLocationCode = lineItem.FulfillmentLocationCode;
retVal.DynamicProperties = null; //to prevent copy dynamic properties from ShoppingCart LineItem to Order LineItem
if (lineItem.Discounts != null)
{
retVal.Discount = lineItem.Discounts.Select(x => x.ToOrderCoreModel()).FirstOrDefault();
}
retVal.TaxDetails = lineItem.TaxDetails;
return retVal;
}