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

            // Obtain list of pet types.
            var petTypeList = _familyDemoAPIv2Repository.GetPetTypes().Result;

            // Map list of pet types to DTO.
            var petTypeListMapping = _mapper.Map <IEnumerable <GetPetTypesDTO> >(petTypeList);

            // Add name to JSON array.
            var petTypeListCollection = new
            {
                value = petTypeListMapping,
            };

            // Return pet type collection.
            return(Ok(petTypeListCollection));
        }