/// <summary> /// Patch CatalogBase type /// </summary> /// <param name="source"></param> /// <param name="target"></param> public static void Patch(this PaymentEntity source, PaymentEntity target) { if (target == null) { throw new ArgumentNullException("target"); } var patchInjection = new PatchInjection <PaymentEntity>(x => x.Amount, x => x.PaymentGatewayCode); target.InjectFrom(patchInjection, source); if (!source.Addresses.IsNullCollection()) { source.Addresses.Patch(target.Addresses, new AddressComparer(), (sourceAddress, targetAddress) => sourceAddress.Patch(targetAddress)); } }
public static PaymentEntity ToDataModel(this Payment payment) { if (payment == null) { throw new ArgumentNullException("payment"); } var retVal = new PaymentEntity(); retVal.InjectFrom(payment); retVal.Currency = payment.Currency.ToString(); if (payment.BillingAddress != null) { retVal.Addresses = new ObservableCollection <AddressEntity>(new AddressEntity[] { payment.BillingAddress.ToDataModel() }); } return(retVal); }