private UserProfileModel ToUserProfileModel(StaffBiography biography, StaffProfileModel profile) { var model = new UserProfileModel { Usi = profile.Staff.StaffUsi, UniqueId = profile.Staff.StaffUniqueId, FirstName = profile.Profile.FirstName, MiddleName = profile.Profile.MiddleName, LastSurname = profile.Profile.LastSurname, Nickname = profile.Profile.NickName, PreferredMethodOfContactTypeId = profile.Profile.PreferredMethodOfContactTypeId, ReplyExpectations = profile.Profile.ReplyExpectations, LanguageCode = profile.Profile.LanguageCode, IdentificationCode = profile.Staff.StaffIdentificationCodes.FirstOrDefault(x => x.AssigningOrganizationIdentificationCode == "LASID")?.IdentificationCode, Addresses = profile.Profile.StaffProfileAddresses.Select(x => new AddressModel { AddressTypeId = x.AddressTypeId, StreetNumberName = x.StreetNumberName, ApartmentRoomSuiteNumber = x.ApartmentRoomSuiteNumber, City = x.City, StateAbbreviationTypeId = x.StateAbbreviationTypeId, PostalCode = x.PostalCode }).ToList(), ElectronicMails = profile.Profile.StaffProfileElectronicMails.Select(x => new ElectronicMailModel { ElectronicMailAddress = x.ElectronicMailAddress, ElectronicMailTypeId = x.ElectronicMailTypeId, PrimaryEmailAddressIndicator = x.PrimaryEmailAddressIndicator }).ToList(), TelephoneNumbers = profile.Profile.StaffProfileTelephones.Select(x => new TelephoneModel { TelephoneNumber = x.TelephoneNumber, TextMessageCapabilityIndicator = x.TextMessageCapabilityIndicator, TelephoneNumberTypeId = x.TelephoneNumberTypeId, PrimaryMethodOfContact = x.PrimaryMethodOfContact, TelephoneCarrierTypeId = x.TelephoneCarrierTypeId, }).ToList() }; if (biography != null) { model.FunFact = biography.FunFact; model.ShortBiography = biography.ShortBiography; model.Biography = biography.Biography; } return(model); }
private BriefProfileModel ToBriefProfileModel(StaffProfileModel profile) { var briefProfileModel = new BriefProfileModel(); var preferredMail = profile.Profile.StaffProfileElectronicMails.FirstOrDefault(x => x.PrimaryEmailAddressIndicator.HasValue && x.PrimaryEmailAddressIndicator.Value).ElectronicMailAddress; var mail = profile.Profile.StaffProfileElectronicMails.FirstOrDefault(); var selectedMail = mail != null ? mail.ElectronicMailAddress : null; briefProfileModel.FirstName = profile.Profile.FirstName; briefProfileModel.MiddleName = profile.Profile.MiddleName; briefProfileModel.LastSurname = profile.Profile.LastSurname; briefProfileModel.Usi = profile.Staff.StaffUsi; briefProfileModel.UniqueId = profile.Staff.StaffUniqueId; briefProfileModel.LanguageCode = profile.Profile.LanguageCode; briefProfileModel.PersonTypeId = ChatLogPersonTypeEnum.Staff.Value; briefProfileModel.Role = "Staff"; briefProfileModel.Email = preferredMail != null ? preferredMail : selectedMail; return(briefProfileModel); }