Esempio n. 1
0
        private static People CreatePeople(SearchResultItemDTO searchResultItem)
        {
            var people = new People(
                profilePath: searchResultItem.ProfilePath,
                isAdult: searchResultItem.IsAdult,
                id: searchResultItem.Id,
                name: searchResultItem.Name,
                popularity: searchResultItem.Popularity);

            if (searchResultItem.KnownFor != null)
            {
                foreach (var knownForItem in searchResultItem.KnownFor)
                {
                    if (knownForItem.MediaType == MediaType.Movie)
                    {
                        people.AddKnownForMovie((Movie)MediaFactory.Create <Movie>(knownForItem));
                    }
                    else if (knownForItem.MediaType == MediaType.Tv)
                    {
                        people.AddKnownForTvShow((TvShow)MediaFactory.Create <TvShow>(knownForItem));
                    }
                }
            }

            return(people);
        }