public bool UpdateMovie(MovieInfo movieInfo)
        {
            try
            {
                bool ret = false;
                using (var connection = _connectionFactory.CreateConnection())
                {
                    using (IDbCommand command = connection.CreateCommand())
                    {
                        command.CommandType = CommandType.StoredProcedure;
                        command.CommandText = "sp_update_movie";

                        IDbDataParameter pId = command.CreateParameter();
                        pId.ParameterName = "@iMovieId";
                        pId.Value         = movieInfo.Id;
                        command.Parameters.Add(pId);

                        IDbDataParameter pTitle = command.CreateParameter();
                        pTitle.ParameterName = "@iTitle";
                        pTitle.Value         = movieInfo.Title;
                        command.Parameters.Add(pTitle);

                        IDbDataParameter pDirector = command.CreateParameter();
                        pDirector.ParameterName = "@iDirector";
                        pDirector.Value         = movieInfo.Director;
                        command.Parameters.Add(pDirector);

                        IDbDataParameter pGenere = command.CreateParameter();
                        pGenere.ParameterName = "@iGenre";
                        pGenere.Value         = movieInfo.Genere;
                        command.Parameters.Add(pGenere);

                        IDbDataParameter pCast = command.CreateParameter();
                        pCast.ParameterName = "@iCast";
                        pCast.Value         = movieInfo.Cast;
                        command.Parameters.Add(pCast);

                        IDbDataParameter pYear = command.CreateParameter();
                        pYear.ParameterName = "@iYear";
                        pYear.Value         = movieInfo.Year;
                        command.Parameters.Add(pYear);

                        IDbDataParameter pAward = command.CreateParameter();
                        pAward.ParameterName = "@iAward";
                        pAward.Value         = movieInfo.Award;
                        command.Parameters.Add(pAward);

                        IDbDataParameter pIsOnShow = command.CreateParameter();
                        pIsOnShow.ParameterName = "@iIsOnShow";
                        pIsOnShow.Value         = movieInfo.IsOnShow;
                        command.Parameters.Add(pIsOnShow);

                        IDbDataParameter pRet = command.CreateParameter();
                        pRet.ParameterName = "@oRet";
                        pRet.Direction     = ParameterDirection.Output;
                        pRet.DbType        = DbType.Int32;
                        pRet.Size          = 50;
                        command.Parameters.Add(pRet);
                        connection.Open();
                        command.ExecuteNonQuery();
                        connection.Close();
                        ret = Convert.ToBoolean(pRet.Value);
                    }
                    if (!ret)
                    {
                        throw new Exception();
                    }
                }
                return(ret);
            }
            catch (Exception ex)
            {
                throw new Exception($"Unable to update movie. {ex.Message}");
            }
        }
        public int AddMovie(MovieInfo movieInfo)
        {
            try
            {
                int id = -1;
                using (var connection = _connectionFactory.CreateConnection())
                {
                    using (IDbCommand command = connection.CreateCommand())
                    {
                        command.CommandType = CommandType.StoredProcedure;
                        command.CommandText = "sp_add_movie";

                        IDbDataParameter pTitle = command.CreateParameter();
                        pTitle.ParameterName = "@iTitle";
                        pTitle.Value         = movieInfo.Title;
                        command.Parameters.Add(pTitle);

                        IDbDataParameter pDirector = command.CreateParameter();
                        pDirector.ParameterName = "@iDirector";
                        pDirector.Value         = movieInfo.Director;
                        command.Parameters.Add(pDirector);

                        IDbDataParameter pGenere = command.CreateParameter();
                        pGenere.ParameterName = "@iGenre";
                        pGenere.Value         = movieInfo.Genere;
                        command.Parameters.Add(pGenere);

                        IDbDataParameter pCast = command.CreateParameter();
                        pCast.ParameterName = "@iCast";
                        pCast.Value         = movieInfo.Cast;
                        command.Parameters.Add(pCast);

                        IDbDataParameter pYear = command.CreateParameter();
                        pYear.ParameterName = "@iYear";
                        pYear.Value         = movieInfo.Year;
                        command.Parameters.Add(pYear);

                        IDbDataParameter pAward = command.CreateParameter();
                        pAward.ParameterName = "@iAward";
                        pAward.Value         = movieInfo.Award;
                        command.Parameters.Add(pAward);

                        IDbDataParameter pId = command.CreateParameter();
                        pId.ParameterName = "@oId";
                        pId.Direction     = ParameterDirection.Output;
                        pId.DbType        = DbType.Int32;
                        pId.Size          = 50;
                        command.Parameters.Add(pId);

                        connection.Open();
                        command.ExecuteNonQuery();
                        connection.Close();
                        id = Convert.ToInt32(pId.Value);
                    }
                    if (id <= 0)
                    {
                        throw new Exception();
                    }
                }
                return(id);
            }
            catch (Exception ex)
            {
                throw new Exception($"Unable to add movie. {ex.Message}");
            }
        }