Exemplo n.º 1
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;
        }
Exemplo n.º 2
0
 private void CreatePersonForNewUser(RegisterModel model)
 {
     var userId = webSecurityService.GetUserId(model.UserName);
     var contactInformation = new ContactInformation();
     contactInformation.Email1 = model.Email;
     var person = new Person() { UserId = userId, FirstName = model.FirstName, LastName = model.LastName, ContactInformation = contactInformation };
     this.personService.Save(person);
 }
Exemplo n.º 3
0
        internal ContactInformation ToModel()
        {
            State state = null;
            List<State> list = StaticCache.GetStates();
            
            if (this.StateId != 0)
            {
                state = new State();
                state = list.Single(s => s.Id == this.StateId);
            }
            else if (this.State != null)
            {
                state = new State();
                state = list.Single(s => s.Name == this.State);
            }
            var contactInfo = new ContactInformation
            {
                Id = this.Id,
                Address1 = this.Address1,
                Address2 = this.Address2,
                City = this.City,
                State = state,
                StateId = state.Id,
                ZipCode = this.Zip,
                Country = null,
                Email1 = this.Email1,
                Phone1 = this.Phone1,
                Website1 = this.Website1
            };


            return contactInfo;

        }