예제 #1
0
        /// <summary>
        /// Converts this instance of <see cref="AddressDTO"/> to an instance of <see cref="Address"/>.
        /// </summary>
        /// <param name="dto"><see cref="AddressDTO"/> to convert.</param>
        public static Address ToEntity(this AddressDTO dto)
        {
            if (dto == null)
            {
                return(null);
            }

            var entity = new Address();

            entity.AddressID     = dto.AddressID;
            entity.Title         = dto.Title;
            entity.Line1         = dto.Line1;
            entity.Line2         = dto.Line2;
            entity.Line3         = dto.Line3;
            entity.City          = dto.City;
            entity.State         = dto.State;
            entity.ZipCode       = dto.ZipCode;
            entity.CountryID     = dto.CountryID;
            entity.AddressTypeID = dto.AddressTypeID;

            dto.OnEntity(entity);

            return(entity);
        }