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; }); } }
/// <summary> /// Patch changes /// </summary> /// <param name="source"></param> /// <param name="target"></param> public static void Patch(this dataModel.QuoteRequestEntity source, dataModel.QuoteRequestEntity target) { if (target == null) throw new ArgumentNullException("target"); target.Tag = source.Tag; var patchInjection = new PatchInjection<dataModel.QuoteRequestEntity>(x => x.CancelledDate, x => x.CancelReason, x => x.ChannelId, x => x.Comment, x => x.InnerComment, x => x.IsLocked, x => x.IsCancelled, x => x.LanguageCode, x => x.OrganizationId, x => x.OrganizationName, x => x.ReminderDate, x => x.Status, x => x.StoreId, x => x.StoreName, x => x.ShipmentMethodCode, x => x.ShipmentMethodOption, x => x.EmployeeId, x => x.EmployeeName, x => x.Currency, x=>x.ManualShippingTotal, x=>x.ManualRelDiscountAmount, x=>x.ManualSubTotal, x=>x.IsSubmitted, x=>x.CustomerId, x=>x.CustomerName); target.InjectFrom(patchInjection, source); if (!source.Addresses.IsNullCollection()) { source.Addresses.Patch(target.Addresses, (sourceAddress, targetAddress) => { return; } ); } if (!source.Attachments.IsNullCollection()) { source.Attachments.Patch(target.Attachments, (sourceAttachment, targetAttachment) => { return; } ); } if (!source.Items.IsNullCollection()) { source.Items.Patch(target.Items, (sourceItem, targetItem) => sourceItem.Patch(targetItem)); } }