public void updateMovie(int id, String title, String releaseDate, String description, String duration, String genre, String director, String rating)
        {
            if (title == "")
            {
                throw new Exception("title can't be empty ");
            }
            if (releaseDate == "")
            {
                throw new Exception("releaseDate can't be empty ");
            }
            if (description == "")
            {
                throw new Exception("description can't be empty ");
            }
            if (duration == "")
            {
                throw new Exception("duration can't be empty ");
            }
            if (genre == "")
            {
                throw new Exception("genre can't be empty ");
            }
            if (director == "")
            {
                throw new Exception("director can't be empty ");
            }
            if (rating == "")
            {
                throw new Exception("rating can't be empty ");
            }

            Models.Movie movie = new Models.Movie(id, title, releaseDate, description, duration, genre, director, rating);

            dbC.updateMovie(movie);
        }
        public List <Models.Movie> getMovies()
        {
            List <Models.Movie> movies = new List <Models.Movie>();

            String query = "SELECT * FROM movie";

            MySqlConnection databaseConnection = new MySqlConnection(MysqlConnetionString);
            MySqlCommand    comandDatabase     = new MySqlCommand(query, databaseConnection);

            comandDatabase.CommandTimeout = 60;
            try
            {
                databaseConnection.Open();
                MySqlDataReader myReader = comandDatabase.ExecuteReader();
                if (myReader.HasRows)
                {
                    while (myReader.Read())
                    {
                        Models.Movie movie = new Models.Movie(int.Parse(myReader[0].ToString()), myReader[1].ToString(), myReader[2].ToString(), myReader[3].ToString(), myReader[4].ToString(), myReader[5].ToString(), myReader[6].ToString(), myReader[7].ToString());
                        //movie.showMovie();
                        movies.Add(movie);
                    }

                    return(movies);
                }
                else
                {
                    return(movies);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        void initFunc(string id)
        {
            BL.Movie movieLogic = new BL.Movie();

            movie = movieLogic.findMovie(id);

            txtTitle.Text             = movie.title;
            txtDescription.Text       = movie.description;
            txtDuration.Text          = movie.duration;
            txtGenre.Text             = movie.genre;
            txtDirector.Text          = movie.director;
            txtRating.Text            = movie.rating;
            dtRelaseDate.SelectedDate = DateTime.Parse(movie.releaseDate);
        }
        public void updateMovie(Models.Movie movie)
        {
            String          query = "UPDATE `movie` SET `title` = '" + movie.title + "', `releaseDate` = '" + movie.releaseDate + "', `description` = '" + movie.description + "', `duration` = '" + movie.duration + "', `genre` = '" + movie.genre + "', `director` = '" + movie.director + "', `rating` = '" + movie.rating + "' WHERE `movie`.`id` = " + movie.id + "";
            MySqlConnection databaseConnection = new MySqlConnection(MysqlConnetionString);
            MySqlCommand    comandDatabase     = new MySqlCommand(query, databaseConnection);

            comandDatabase.CommandTimeout = 60;
            try
            {
                databaseConnection.Open();
                MySqlDataReader myReader = comandDatabase.ExecuteReader();
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        public void addMovie(Models.Movie movie)
        {
            String query = "INSERT INTO `movie` (`id`, `title`, `releaseDate`, `description`, `duration`, `genre`, `director`, `rating`) VALUES (NULL, '" + movie.title + "', '" + movie.releaseDate + "', '" + movie.description + "', '" + movie.duration + "', '" + movie.genre + "', '" + movie.director + "', '" + movie.rating + "')";

            MySqlConnection databaseConnection = new MySqlConnection(MysqlConnetionString);
            MySqlCommand    comandDatabase     = new MySqlCommand(query, databaseConnection);

            comandDatabase.CommandTimeout = 60;
            try
            {
                databaseConnection.Open();
                MySqlDataReader myReader = comandDatabase.ExecuteReader();
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        public void addMovie(String title, String releaseDate, String description, String duration, String genre, String director, String rating)
        {
            if (title == "")
            {
                throw new Exception("title can't be empty ");
            }
            if (releaseDate == "")
            {
                throw new Exception("releaseDate can't be empty ");
            }
            if (description == "")
            {
                throw new Exception("description can't be empty ");
            }
            if (duration == "")
            {
                throw new Exception("duration can't be empty ");
            }
            if (genre == "")
            {
                throw new Exception("genre can't be empty ");
            }
            if (director == "")
            {
                throw new Exception("director can't be empty ");
            }
            if (rating == "")
            {
                throw new Exception("rating can't be empty ");
            }



            Models.Movie movie = new Models.Movie(title, releaseDate, description, duration, genre, director, rating);
            try
            {
                dbC.addMovie(movie);
            }
            catch (Exception err) {
                throw err;
            }
        }
        public Models.Movie findMovie(int id)
        {
            String query = "SELECT * FROM `movie` WHERE id = " + id;

            MySqlConnection databaseConnection = new MySqlConnection(MysqlConnetionString);
            MySqlCommand    comandDatabase     = new MySqlCommand(query, databaseConnection);

            comandDatabase.CommandTimeout = 60;
            try
            {
                databaseConnection.Open();
                MySqlDataReader myReader = comandDatabase.ExecuteReader();
                if (myReader.HasRows)
                {
                    if (myReader.Read())
                    {
                        Console.WriteLine("found");

                        Models.Movie movie = new Models.Movie(int.Parse(myReader[0].ToString()), myReader[1].ToString(), myReader[2].ToString(), myReader[3].ToString(), myReader[4].ToString(), myReader[5].ToString(), myReader[6].ToString(), myReader[7].ToString());

                        movie.showMovie();
                        return(movie);
                    }

                    throw new Exception("Reader can't read");
                }
                else
                {
                    throw new Exception("movie not found");
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }