Beispiel #1
0
        /// <summary>
        /// Removes all movies from the list argument that do not have all of the
        /// actors that are specified in the argument.
        /// </summary>
        /// <param name="movies"></param>
        /// <param name="actorName"></param>
        private List <string> FilterMoviesByActors(string[] actorNames)
        {
            var filterResults = new List <List <string> >();

            foreach (var actorName in actorNames)
            {
                var actor = _repo.GetActor(actorName);
                if (actor != null)
                {
                    var movieActors  = _repo.GetMovieActorsById(actor.ActorId);
                    var filterResult = new List <string>();
                    foreach (var movieActor in movieActors)
                    {
                        filterResult.Add(movieActor.ImdbId);
                    }
                    filterResults.Add(filterResult);
                }
            }

            var movieIds = GetIntersection(filterResults);

            return(movieIds);
        }