public static void DeAsociateDirectorToMovie(byte[] frame)
        {
            IDirectorDataAccess dirDa           = new DirectorDataAccess();
            IDirectorService    directorService = new DirectorService(dirDa);

            IMovieDataAccess movieDataAccess = new MovieDataAccess();
            IMovieService    movieService    = new MovieService(movieDataAccess);

            IAsociationHandler asociationHandler = new AssociationHandler();
            IAsociationService asociationService = new AsociationService(asociationHandler);

            IParser parser = new Parser();

            var directorAndMovieNames = parser.GetDataObject(frame);
            var movieToAsociate       = movieService.GetMovie(directorAndMovieNames[0]);
            var directorToASociate    = directorService.GetDirector(directorAndMovieNames[1]);

            asociationService.DeAsociatDirMovie(movieToAsociate, directorToASociate);
        }
        public static void DeAsociateGenreToMovie(byte[] frame)
        {
            IGenreDataAccess genreDataAccess = new GenreDataAccess();
            IGenreService    genreService    = new GenreService(genreDataAccess);

            IMovieDataAccess movieDataAccess = new MovieDataAccess();
            IMovieService    movieService    = new MovieService(movieDataAccess);

            IAsociationHandler asociationHandler = new AssociationHandler();
            IAsociationService asociationService = new AsociationService(asociationHandler);

            IParser parser = new Parser();


            var movieAndGenreNames = parser.GetDataObject(frame);
            var movieToAsociate    = movieService.GetMovie(movieAndGenreNames[0]);
            var genreToAsociate    = genreService.GetGenre(movieAndGenreNames[1]);

            asociationService.DeAsociateGenreMovie(movieToAsociate, genreToAsociate);
        }
        public static void Modify(byte[] frame)
        {
            IMovieDataAccess movieDataAccess = new MovieDataAccess();
            IMovieService    movieService    = new MovieService(movieDataAccess);
            IParser          parser          = new Parser();

            var data = parser.GetDataObject(frame);

            string oldName = data[0];

            var   genreList = movieService.GetMovie(oldName).Genres;
            Movie movie     = new Movie
            {
                Name     = data[1],
                Date     = DateTime.ParseExact(data[2], "yyyy-MM-dd", CultureInfo.InvariantCulture),
                Director = data[3],
                Genres   = genreList
            };

            movieService.Update(oldName, movie);
        }
        public static void Upload(byte[] frame)
        {
            IMovieDataAccess movieDataAccess = new MovieDataAccess();
            IMovieService    movieService    = new MovieService(movieDataAccess);

            IGenreDataAccess genreData    = new GenreDataAccess();
            IGenreService    genreService = new GenreService(genreData);

            IParser parser = new Parser();

            var   data  = parser.GetDataObject(frame);
            Movie movie = new Movie
            {
                Name     = data[0],
                Date     = DateTime.ParseExact(data[1], "yyyy-MM-dd", CultureInfo.InvariantCulture),
                Director = data[2],
                Files    = new List <string>(),
            };

            try
            {
                movie.Genres = parser.GetList(data[3]);
            }
            catch (IndexOutOfRangeException)
            {
                movie.Genres = new List <string>();
            }

            movieService.Upload(movie);

            //After uploading makes the movie and genre list consistent
            foreach (var genreInMovie in movie.Genres)
            {
                var genreThatNeedsToBeAsociatedToMovie = genreService.GetGenre(genreInMovie);
                genreThatNeedsToBeAsociatedToMovie.MoviesOfGenre.Add(movie.Name);
                genreService.Update(genreThatNeedsToBeAsociatedToMovie.Name, genreThatNeedsToBeAsociatedToMovie);
            }
        }