Ejemplo n.º 1
0
        public static void MapTo(this IHaveEmailAddresses haveEmailAddresses, IHaveEmailAddressesEntity entity)
        {
            entity.primaryEmailAddress           = null;
            entity.primaryEmailAddressVerified   = false;
            entity.secondaryEmailAddress         = null;
            entity.secondaryEmailAddressVerified = false;
            if (haveEmailAddresses == null || haveEmailAddresses.EmailAddresses == null || haveEmailAddresses.EmailAddresses.Count == 0)
            {
                return;
            }

            entity.primaryEmailAddress         = haveEmailAddresses.EmailAddresses[0].Address;
            entity.primaryEmailAddressVerified = haveEmailAddresses.EmailAddresses[0].IsVerified;
            if (haveEmailAddresses.EmailAddresses.Count == 1)
            {
                return;
            }

            entity.secondaryEmailAddress         = haveEmailAddresses.EmailAddresses[1].Address;
            entity.secondaryEmailAddressVerified = haveEmailAddresses.EmailAddresses[1].IsVerified;
        }
Ejemplo n.º 2
0
        public static void MapTo(this IHaveEmailAddressesEntity entity, IHaveEmailAddresses haveEmailAddresses)
        {
            if (string.IsNullOrEmpty(entity.primaryEmailAddress))
            {
                haveEmailAddresses.EmailAddresses = null;
                return;
            }

            haveEmailAddresses.EmailAddresses = new List <EmailAddress>
            {
                new EmailAddress {
                    Address = entity.primaryEmailAddress, IsVerified = entity.primaryEmailAddressVerified
                }
            };

            if (string.IsNullOrEmpty(entity.secondaryEmailAddress) || entity.secondaryEmailAddressVerified == null)
            {
                return;
            }
            haveEmailAddresses.EmailAddresses.Add(new EmailAddress {
                Address = entity.secondaryEmailAddress, IsVerified = entity.secondaryEmailAddressVerified.Value
            });
        }