예제 #1
0
        public IActionResult GetStates()
        {
            var stateEntities = _myAppRepository.GetStates();

            //var results = new List<StateWithoutCountiesDto>();
            //foreach (var stateEntity in stateEntities)
            //{
            //    results.Add(new StateWithoutCountiesDto
            //    {
            //        Id = stateEntity.Id,
            //        Name = stateEntity.Name,
            //        PostalCode = stateEntity.PostalCode
            //    });
            //}

            return(Ok(_mapper.Map <IEnumerable <StateWithoutCountiesDto> >(stateEntities)));
        }