Beispiel #1
0
        public List <Person> ExtractPeopleFromMovieObject(Movie movie, ExtractType type)
        {
            List <Entities.Person> people;

            switch (type)
            {
            case ExtractType.Actor:
                people = movie.Actors.Select(x => new Person {
                    Name = x.ActorName
                }).ToList();
                break;

            case ExtractType.Director:
                people = movie.Directors.Select(x => new Person {
                    Name = x.Name
                }).ToList();
                break;

            case ExtractType.Writer:
                people = movie.Writers.Select(x => new Person {
                    Name = x.Name
                }).ToList();
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }

            return(people);
        }
Beispiel #2
0
        /// <summary>
        /// Use this only to see what can be extracted
        /// </summary>
        public Dictionary <string, object> ExtractDataFromMovieObject(Movie movie)
        {
            var people = new List <Entities.Person>();

            var m = new Entities.Movie
            {
                FilmingLocations = movie.FilmingLocations,
                Genres           = movie.Genres,
                Countries        = movie.Countries,
                Languages        = movie.Languages,
                Plot             = movie.Plot,
                Rated            = movie.Rated,
                Title            = movie.Title,
                Rating           = movie.Rating,
                Year             = movie.Year
            };

            people.AddRange(movie.Actors.Select(a => new Person {
                Name = a.ActorName
            }));
            people.AddRange(movie.Directors.Select(d => new Person {
                Name = d.Name
            }));
            people.AddRange(movie.Writers.Select(w => new Person {
                Name = w.Name
            }));

            return(new Dictionary <string, object>
            {
                { "Movie", m },
                { "People", people }
            });
        }
        /// <summary>
        /// Use this only to see what can be extracted
        /// </summary>
        public Dictionary<string, object> ExtractDataFromMovieObject(Movie movie)
        {
            var people = new List<Entities.Person>();

            var m = new Entities.Movie
            {
                FilmingLocations = movie.FilmingLocations,
                Genres = movie.Genres,
                Countries = movie.Countries,
                Languages = movie.Languages,
                Plot = movie.Plot,
                Rated = movie.Rated,
                Title = movie.Title,
                Rating = movie.Rating,
                Year = movie.Year
            };

            people.AddRange(movie.Actors.Select(a => new Person {Name = a.ActorName}));
            people.AddRange(movie.Directors.Select(d => new Person {Name = d.Name}));
            people.AddRange(movie.Writers.Select(w => new Person {Name = w.Name}));

            return new Dictionary<string, object>
            {
                {"Movie", m},
                {"People", people}
            };
        }
Beispiel #4
0
 public Entities.Movie ExtractImportantDataFromMovieObject(Movie movie)
 {
     return(new Entities.Movie
     {
         FilmingLocations = movie.FilmingLocations,
         Genres = movie.Genres,
         Countries = movie.Countries,
         Languages = movie.Languages,
         Plot = movie.Plot,
         Rated = movie.Rated,
         Title = movie.Title,
         Rating = movie.Rating,
         Year = movie.Year
     });
 }
 public Entities.Movie ExtractImportantDataFromMovieObject(Movie movie)
 {
     return new Entities.Movie
     {
         FilmingLocations = movie.FilmingLocations,
         Genres = movie.Genres,
         Countries = movie.Countries,
         Languages = movie.Languages,
         Plot = movie.Plot,
         Rated = movie.Rated,
         Title = movie.Title,
         Rating = movie.Rating,
         Year = movie.Year
     };
 }
        public List<Person> ExtractPeopleFromMovieObject(Movie movie, ExtractType type)
        {
            List<Entities.Person> people;

            switch (type)
            {
                case ExtractType.Actor:
                    people = movie.Actors.Select(x => new Person {Name = x.ActorName}).ToList();
                    break;
                case ExtractType.Director:
                    people = movie.Directors.Select(x => new Person {Name = x.Name}).ToList();
                    break;
                case ExtractType.Writer:
                    people = movie.Writers.Select(x => new Person {Name = x.Name}).ToList();
                    break;
                default:
                    throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }

            return people;
        }