public static Contact ToContact(this NGContact contact) { var winContact = new Contact() { FirstName = contact.FirstName, MiddleName = contact.MiddleName, LastName = contact.LastName, Nickname = contact.Nickname, HonorificNamePrefix = contact.Prefix, HonorificNameSuffix = contact.Suffix, SourceDisplayPicture = RandomAccessStreamReference.CreateFromStream(contact.Picture.AsRandomAccessStream()), Notes = contact.Notes }; winContact.Emails.AddRange(contact.Emails.Select(e => e.ToContactEmail())); winContact.Addresses.AddRange(contact.Addresses.Select(a => a.ToContactAddress())); winContact.ImportantDates.AddRange(contact.Dates.Select(d => d.ToContactDate())); winContact.JobInfo.AddRange(contact.JobInfo.Select(j => j.ToContactJobInfo())); winContact.Phones.AddRange(contact.Phones.Select(p => p.ToContactPhone())); winContact.Websites.AddRange(contact.Websites.Select(w => w.ToContactWebsite())); return(winContact); }
public static async Task <NGContact> ToNGContact(this Contact contact) { var ngContact = new NGContact() { FirstName = contact.FirstName, MiddleName = contact.MiddleName, LastName = contact.LastName, Nickname = contact.Nickname, Prefix = contact.HonorificNamePrefix, Suffix = contact.HonorificNameSuffix, Picture = (await contact.SourceDisplayPicture.OpenReadAsync()).AsStream(), Notes = contact.Notes }; ngContact.Emails.AddRange(contact.Emails.Select(e => e.ToNGEmail())); ngContact.Addresses.AddRange(contact.Addresses.Select(a => a.ToNGAddress())); ngContact.Dates.AddRange(contact.ImportantDates.Select(d => d.ToNGDate())); ngContact.JobInfo.AddRange(contact.JobInfo.Select(j => j.ToNGJobInfo())); ngContact.Phones.AddRange(contact.Phones.Select(p => p.ToNGPhone())); ngContact.Websites.AddRange(contact.Websites.Select(w => w.ToNGWebsite())); return(ngContact); }