public static dataModel.QuoteItemEntity ToDataModel(this coreModel.QuoteItem quoteItem) { if (quoteItem == null) throw new ArgumentNullException("quoteItem"); var retVal = new dataModel.QuoteItemEntity(); retVal.InjectFrom(quoteItem); retVal.Currency = quoteItem.Currency.ToString(); if (quoteItem.ProposalPrices != null) { retVal.ProposalPrices = new ObservableCollection<dataModel.TierPriceEntity>(quoteItem.ProposalPrices.Select(x => x.ToDataModel())); } return retVal; }
public static void Patch(this dataModel.QuoteItemEntity source, dataModel.QuoteItemEntity target) { if (target == null) { throw new ArgumentNullException("target"); } var patchInjection = new PatchInjection <dataModel.QuoteItemEntity>(x => x.Comment); target.InjectFrom(patchInjection, source); if (!source.ProposalPrices.IsNullCollection()) { var tierPriceComparer = AnonymousComparer.Create((dataModel.TierPriceEntity x) => x.Quantity + "-" + x.Price); source.ProposalPrices.Patch(target.ProposalPrices, tierPriceComparer, (sourceTierPrice, targetTierPrice) => { return; }); } }
public static dataModel.QuoteItemEntity ToDataModel(this coreModel.QuoteItem quoteItem) { if (quoteItem == null) { throw new ArgumentNullException("quoteItem"); } var retVal = new dataModel.QuoteItemEntity(); retVal.InjectFrom(quoteItem); retVal.Currency = quoteItem.Currency.ToString(); if (quoteItem.ProposalPrices != null) { retVal.ProposalPrices = new ObservableCollection <dataModel.TierPriceEntity>(quoteItem.ProposalPrices.Select(x => x.ToDataModel())); } return(retVal); }