Пример #1
0
        private MovieDTOCollection MovieCollectionToDTO(MovieCollection movieCollection)
        {
            MovieDTOCollection tempList = new MovieDTOCollection();
            MovieDTO tempItem;

            if (movieCollection != null)
            {
                foreach (Movie item in movieCollection)
                {
                    tempItem = new MovieDTO();
                    tempItem.MovieId = item.MovieId;

                    if (item.MovieTitle != null)
                    {
                        tempItem.MovieTitle = item.MovieTitle;
                    }
                    if (item.RatingName != null)
                    {
                        tempItem.RatingsName = item.RatingName;
                    }
                    if (item.YearReleased != null)
                    {
                        tempItem.YearReleased = item.YearReleased.ToString();
                    }

                    tempList.Add(tempItem);
                }
            }
            return tempList;
        }
Пример #2
0
 public static void ImportMoviesCollection(MovieDTOCollection movieDtos)
 {
     foreach (var movieDto in movieDtos.MovieDTOs)
     {
         try
         {
             ImportMovie(movieDto);
         }
         catch (Exception e)
         {
             Console.WriteLine(e.Message);
         }
     }
 }
Пример #3
0
        public static void ImportMovies()
        {
            MovieDTOCollection movieDtos = MovieImportService.DeserializeMovies(DataPaths.MoviesXml);

            MovieImportService.ImportMoviesCollection(movieDtos);
        }