Пример #1
0
        public ActionResult <IEnumerable <GetBirthStateDTO> > GetStates()
        {
            // Log Api call.  Could be moved to database for future anayltics.
            _log.WriteInformation("Controller:BirthState,API:GetStates,DateTime:" + DateTime.Now.ToString());

            // Obtain list of states.
            var states = _familyDemoAPIv2Repository.GetBirthStates().Result;

            // Map list of states to DTO.
            var birthstates = _mapper.Map <IEnumerable <GetBirthStateDTO> >(states);

            // Add name to JSON array.
            var birthStatesCollection = new
            {
                value = birthstates,
            };

            // Return states collection.
            return(Ok(birthStatesCollection));
        }