Exemplo n.º 1
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;

        }
        private State CreateState()
        {
            var state = new State()
            {
                Abbreviation = "AA",
                Name = "TEST"
            };

            this.SaveState(state);
            return state;
        }
 private void SaveState(State state)
 {
     if (state.Id == 0)
     {
         stateRepository.Insert(state);
     }
     else
     {
         stateRepository.Update(state);
     }
     try
     {
         ((IUnitOfWork)unitOfWork).Commit();
     }
     catch
     {
         throw;
     }
 }