internal static ContactInformationVm FromModel(ContactInformation contactInfo)
        {
            ContactInformationVm contactInfoVm = null;
            if (contactInfo != null)
            {
                contactInfoVm = new ContactInformationVm
                {
                    Id = contactInfo.Id,
                    Address1 = contactInfo.Address1,
                    Address2 = contactInfo.Address2,
                    City = contactInfo.City,
                    Zip = contactInfo.ZipCode,
                    Email1 = contactInfo.Email1,
                    Website1 = contactInfo.Website1,
                    Phone1 = contactInfo.Phone1
                };

                if (contactInfo.State != null)
                {
                    contactInfoVm.State = contactInfo.State.Name;
                    contactInfoVm.StateId = contactInfo.State.Id;
                }
                else if (contactInfo.StateId != 0 && contactInfo.StateId != null)
                {
                    contactInfoVm.StateId = (int)contactInfo.StateId;
                }

                if (contactInfo.Country != null)
                    contactInfoVm.Country = contactInfo.Country.Name;
            }

            return contactInfoVm;
        }
Beispiel #2
0
        internal static PersonVm FromModel(Person person)
        {
            if (person.ContactInformation == null)
            {
                person.ContactInformation = new ContactInformation();
            }
            var userProfileVm = new PersonVm
            {
                Id                 = person.Id,
                Birthday           = person.Birthday,
                First              = person.FirstName,
                Middle             = person.MiddleName,
                Last               = person.LastName,
                ContactInformation = ContactInformationVm.FromModel(person.ContactInformation)
            };

            return(userProfileVm);
        }
Beispiel #3
0
        internal static ContactInformationVm FromModel(ContactInformation contactInfo)
        {
            ContactInformationVm contactInfoVm = null;

            if (contactInfo != null)
            {
                contactInfoVm = new ContactInformationVm
                {
                    Id       = contactInfo.Id,
                    Address1 = contactInfo.Address1,
                    Address2 = contactInfo.Address2,
                    City     = contactInfo.City,
                    Zip      = contactInfo.ZipCode,
                    Email1   = contactInfo.Email1,
                    Website1 = contactInfo.Website1,
                    Phone1   = contactInfo.Phone1
                };

                if (contactInfo.State != null)
                {
                    contactInfoVm.State   = contactInfo.State.Name;
                    contactInfoVm.StateId = contactInfo.State.Id;
                }
                else if (contactInfo.StateId != 0 && contactInfo.StateId != null)
                {
                    contactInfoVm.StateId = (int)contactInfo.StateId;
                }

                if (contactInfo.Country != null)
                {
                    contactInfoVm.Country = contactInfo.Country.Name;
                }
            }

            return(contactInfoVm);
        }