private UserProfileModel ToUserProfileModel(ParentBiography biography, ParentProfileModel profile) { var model = new UserProfileModel { Usi = profile.Parent.ParentUsi, UniqueId = profile.Parent.ParentUniqueId, FirstName = profile.ParentProfile.FirstName, MiddleName = profile.ParentProfile.MiddleName, LastSurname = profile.ParentProfile.LastSurname, Nickname = profile.ParentProfile.NickName, PreferredMethodOfContactTypeId = profile.ParentProfile.PreferredMethodOfContactTypeId, ReplyExpectations = profile.ParentProfile.ReplyExpectations, LanguageCode = profile.ParentProfile.LanguageCode, Addresses = profile.ParentProfile.ParentProfileAddresses.Select(x => new AddressModel { AddressTypeId = x.AddressTypeDescriptorId, StreetNumberName = x.StreetNumberName, ApartmentRoomSuiteNumber = x.ApartmentRoomSuiteNumber, City = x.City, StateAbbreviationTypeId = x.StateAbbreviationDescriptorId, PostalCode = x.PostalCode }).ToList(), ElectronicMails = profile.ParentProfile.ParentProfileElectronicMails.Select(x => new ElectronicMailModel { ElectronicMailAddress = x.ElectronicMailAddress, ElectronicMailTypeId = x.ElectronicMailTypeDescriptorId, PrimaryEmailAddressIndicator = x.PrimaryEmailAddressIndicator }).ToList(), TelephoneNumbers = profile.ParentProfile.ParentProfileTelephones.Select(x => new TelephoneModel { TelephoneNumber = x.TelephoneNumber, TextMessageCapabilityIndicator = x.TextMessageCapabilityIndicator, TelephoneNumberTypeId = x.TelephoneNumberTypeDescriptorId, PrimaryMethodOfContact = x.PrimaryMethodOfContact, TelephoneCarrierTypeId = x.TelephoneCarrierTypeId, SMSDomain = x.TextMessageCarrierType?.SmsSuffixDomain }).ToList() }; if (biography != null) { model.FunFact = biography.FunFact; model.ShortBiography = biography.ShortBiography; model.Biography = biography.Biography; } return(model); }
private BriefProfileModel ToBriefProfileModel(ParentProfileModel profile) { var briefProfileModel = new BriefProfileModel(); var preferredMail = profile.ParentProfile.ParentProfileElectronicMails.FirstOrDefault(x => x.PrimaryEmailAddressIndicator.HasValue && x.PrimaryEmailAddressIndicator.Value)?.ElectronicMailAddress; var mail = profile.ParentProfile.ParentProfileElectronicMails.FirstOrDefault(); var selectedMail = mail != null ? mail.ElectronicMailAddress : null; briefProfileModel.FirstName = profile.ParentProfile.FirstName; briefProfileModel.MiddleName = profile.ParentProfile.MiddleName; briefProfileModel.LastSurname = profile.ParentProfile.LastSurname; briefProfileModel.Usi = profile.Parent.ParentUsi; briefProfileModel.UniqueId = profile.Parent.ParentUniqueId; briefProfileModel.LanguageCode = profile.ParentProfile.LanguageCode; briefProfileModel.PersonTypeId = ChatLogPersonTypeEnum.Parent.Value; briefProfileModel.Role = "Parent"; briefProfileModel.Email = preferredMail != null? preferredMail : selectedMail; return(briefProfileModel); }