public void DeleteGame(Game Game)
        {
            MySqlTransaction trans = null;
            try
            {
                conn.Open();
                trans = conn.BeginTransaction();
                string insertString = @"delete from game where game_id=@id";

                MySqlCommand cmd = new MySqlCommand(insertString, conn);
                MySqlParameter idParam = new MySqlParameter("@id", MySqlDbType.Int32);
                idParam.Value = Game.ID;

                cmd.Parameters.Add(idParam);
                cmd.Prepare();
                cmd.ExecuteNonQuery();

                trans.Commit();

            }
            catch (Exception e)
            {
                trans.Rollback();
                Console.Write("Game niet verwijderd: " + e);
                throw e;
            }
            finally
            {
                conn.Close();
            }
        }
        protected Game GetGameFromDataReader(MySqlDataReader dataReader)
        {
            string gameNaam = dataReader.GetString("gamenaam");
            int gameId = dataReader.GetInt32("game_id");
            Game game = new Game { ID =gameId, Naam = gameNaam};

            return game;
        }
        public void UpdateGame(Game Game)
        {
            MySqlTransaction trans = null;
            try
            {
                conn.Open();
                trans = conn.BeginTransaction();
                string insertString = @"update Game set gamenaam=@gamenaam, genre_id=@genre_id where game_id=@game_id";

                MySqlCommand cmd = new MySqlCommand(insertString, conn);
                MySqlParameter gamenaamParam = new MySqlParameter("@gamenaam", MySqlDbType.VarChar);
                MySqlParameter genreParam = new MySqlParameter("@genre_id", MySqlDbType.Int32);
                MySqlParameter gameParam = new MySqlParameter("@game_id", MySqlDbType.Int32);

                gamenaamParam.Value = Game.Naam;
                genreParam.Value = Game.Genre.ID;
                gameParam.Value = Game.ID;

                cmd.Parameters.Add(gamenaamParam);
                cmd.Parameters.Add(genreParam);
                cmd.Parameters.Add(gameParam);

                cmd.Prepare();
                cmd.ExecuteNonQuery();
                trans.Commit();

            }
            catch (Exception e)
            {
                trans.Rollback();
                Console.Write("Updaten game niet gelukt: " + e);
                throw e;
            }
            finally
            {
                conn.Close();
            }
        }
        public void InsertGame(Game Game)
        {
            MySqlTransaction trans = null;
            try
            {
                conn.Open();
                trans = conn.BeginTransaction();

                string insertString = @"insert into Game (gamenaam, genre_id) values (@gamenaam, @genre_id)";

                MySqlCommand cmd = new MySqlCommand(insertString, conn);
                MySqlParameter gamenaamParam = new MySqlParameter("@gamenaam", MySqlDbType.VarChar);
                MySqlParameter genreParam = new MySqlParameter("@genre_id", MySqlDbType.Int32);

                gamenaamParam.Value = Game.Naam;
                genreParam.Value = Game.Genre.ID;
                cmd.Parameters.Add(gamenaamParam);
                cmd.Parameters.Add(genreParam);

                cmd.Prepare();
                cmd.ExecuteNonQuery();

                trans.Commit();

            }
            catch (Exception e)
            {
                trans.Rollback();
                Console.Write("Game niet toegevoegd: " + e);
                throw e;
            }
            finally
            {
                conn.Close();
            }
        }