/// <summary> /// Get's <see cref="DogProfile"/> object for single dog, including basic details, /// biography, album images, and generated temperament scores /// </summary> /// <param name="id">Dog Id <see cref="int"/></param> /// <returns>Single <see cref="DogProfile"/> object</returns> public async Task <DogProfile> GetDogProfile(int id) { Dogs dog = await _dogRepository.FindFullDogProfileById(id); // if dog doesn't exist, return null if (dog == null) { return(null); } // initialize dog profile and map dog's basic details and album images DogProfile dogProfile = new DogProfile() { Dog = _mapper.Map <Dog>(dog), AlbumImages = _mapper.Map <List <AlbumImage> >(dog.AlbumImages) }; // if all temperament values are populated (not null or zero), generate and set temperament scores if (_temperamentRepository.HasCompletedTemperament(dog.Temperament)) { dogProfile.HasTemperament = true; dogProfile.TemperamentScores = GetTemperamentScores(dog.Temperament); } // if any biography properties are populated, map and set values if (HasBiography(dog.Biography)) { dogProfile.HasBio = true; dogProfile.Bio = _mapper.Map <DogBiography>(dog.Biography); } return(dogProfile); }