예제 #1
0
        /// <summary>
        /// Removes all movies from the list argument that do not have all of the
        /// directors that are specified in the argument.
        /// </summary>
        /// <param name="movies"></param>
        /// <param name="directorName"></param>
        private List <string> FilterMoviesByDirectors(string[] directorNames)
        {
            var filterResults = new List <List <string> >();

            foreach (var directorName in directorNames)
            {
                var director = _repo.GetDirector(directorName);
                if (director != null)
                {
                    var movieDirectors = _repo.GetMovieDirectorsById(director.DirectorId);
                    var filterResult   = new List <string>();
                    foreach (var movieDirector in movieDirectors)
                    {
                        filterResult.Add(movieDirector.ImdbId);
                    }
                    filterResults.Add(filterResult);
                }
            }

            var movieIds = GetIntersection(filterResults);

            return(movieIds);
        }