Beispiel #1
0
 public virtual Address ToModel(Address address)
 {
     address.InjectFrom(this);
     address.Phone       = this.DaytimePhoneNumber;
     address.AddressType = EnumUtility.SafeParse(this.Type, AddressType.BillingAndShipping);
     return(address);
 }
Beispiel #2
0
        /// <summary>
        /// Patch
        /// </summary>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public static void Patch(this dataModel.Address source, dataModel.Address target)
        {
            var patchInjectionPolicy = new PatchInjection <dataModel.Address>(x => x.City, x => x.CountryCode,
                                                                              x => x.CountryName, x => x.DaytimePhoneNumber,
                                                                              x => x.Email, x => x.EveningPhoneNumber, x => x.FaxNumber,
                                                                              x => x.FirstName, x => x.LastName, x => x.Line1,
                                                                              x => x.Line2, x => x.Name, x => x.Organization, x => x.PostalCode,
                                                                              x => x.RegionName, x => x.RegionId, x => x.StateProvince, x => x.Type);

            target.InjectFrom(patchInjectionPolicy, source);
        }
Beispiel #3
0
        public static dataModel.Address ToDataModel(this Domain.Commerce.Model.Address address)
        {
            if (address == null)
            {
                throw new ArgumentNullException("address");
            }

            var retVal = new dataModel.Address();

            retVal.InjectFrom(address);
            retVal.DaytimePhoneNumber = address.Phone;
            return(retVal);
        }