public static AddressEntity ToDataModel(this Address address)
        {
            if (address == null)
            {
                throw new ArgumentNullException("address");
            }

            var retVal = new AddressEntity();

            retVal.InjectFrom(address);

            retVal.AddressType = address.AddressType.ToString();
            return(retVal);
        }
Example #2
0
        /// <summary>
        /// Patch CatalogBase type
        /// </summary>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public static void Patch(this AddressEntity source, AddressEntity target)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            var patchInjectionPolicy = new PatchInjection <AddressEntity>(x => x.City, x => x.CountryCode,
                                                                          x => x.CountryName, x => x.Phone,
                                                                          x => x.Email, x => x.FirstName, x => x.LastName, x => x.Line1,
                                                                          x => x.Line2, x => x.AddressType, x => x.Organization, x => x.PostalCode,
                                                                          x => x.RegionName, x => x.RegionId, x => x.Email);

            target.InjectFrom(patchInjectionPolicy, source);
        }