public static List <VCard> SunamoVCardsToVCards(List <SunamoVCard> vc) { List <VCard> result = new List <VCard>(); List <Telephone> tele = new List <Telephone>(); List <Email> mails = new List <Email>(); foreach (var i in vc) { tele.Clear(); mails.Clear(); foreach (var i2 in i.Telephones) { tele.Add(new Telephone { Number = i2.Number, Preference = i2.Preference, Type = EnumHelperVcf.Parse <TelephoneType>(i2.Type) }); } foreach (var i2 in i.Emails) { mails.Add(new Email { EmailAddress = i2.EmailAddress, Type = EnumHelperVcf.Parse <EmailType>(i2.Type), Preference = i2.Preference }); } result.Add(new VCard { FirstName = i.FirstName, MiddleName = i.MiddleName, LastName = i.LastName, Telephones = tele, Emails = mails }); } return(result); }
public static IEnumerable <SunamoTelephone> Telephones(IEnumerable <Telephone> telephones) { List <SunamoTelephone> l = new List <SunamoTelephone>(); if (telephones != null) { foreach (var i in telephones) { l.Add(new SunamoTelephone { Number = i.Number, Type = EnumHelperVcf.Parse <SunamoTelephoneType>(i.Type), Preference = i.Preference }); } } return(l); }
private static IEnumerable <SunamoEmail> Emails(IEnumerable <Email> emails) { List <SunamoEmail> l = new List <SunamoEmail>(); if (emails != null) { foreach (var i in emails) { l.Add(new SunamoEmail { EmailAddress = i.EmailAddress, Preference = i.Preference, Type = EnumHelperVcf.Parse <SunamoEmailType>(i.Type) }); } } return(l); }