Esempio n. 1
0
        public MovieExtendModel GetByTitle(string title, string userID)
        {
            if (title.Equals(string.Empty) || title.Equals(""))
            {
                throw new ArgumentOutOfRangeException();
            }
            if (userID.Equals(string.Empty) || userID.Equals(""))
            {
                throw new ArgumentOutOfRangeException();
            }

            DataTable dt = new DataTable();

            MovieExtendModel movieModel = new MovieExtendModel();

            using (MySqlCommand command = new MySqlCommand())
            {
                dt = GetMultipleQuery(MovieExtendStringsMySql.GetByTitle(title, userID));
            }

            foreach (DataRow ms in dt.Rows)
            {
                movieModel = MovieExtendModel.ToObject(ms);
            }
            return(movieModel);
        }
Esempio n. 2
0
        public List <MovieExtendModel> GetByWord(string word, string userID)
        {
            if (word.Equals(string.Empty) || word.Equals(""))
            {
                throw new ArgumentOutOfRangeException();
            }

            if (userID.Equals(string.Empty) || userID.Equals(""))
            {
                throw new ArgumentOutOfRangeException();
            }

            DataTable dt = new DataTable();
            List <MovieExtendModel> arrMovie = new List <MovieExtendModel>();

            using (MySqlCommand command = new MySqlCommand())
            {
                dt = GetMultipleQuery(MovieExtendStringsMySql.GetByWord(word, userID));
            }

            foreach (DataRow ms in dt.Rows)
            {
                arrMovie.Add(MovieExtendModel.ToObject(ms));
            }

            return(arrMovie);
        }
Esempio n. 3
0
        public MovieExtendModel UpdateMovie(MovieExtendModel movieModel)
        {
            DataTable dt = new DataTable();

            using (MySqlCommand command = new MySqlCommand())
            {
                dt = GetMultipleQuery(MovieExtendStringsMySql.UpdateMovie(movieModel));
            }
            foreach (DataRow ms in dt.Rows)
            {
                movieModel = MovieExtendModel.ToObject(ms);
            }

            return(movieModel);
        }
Esempio n. 4
0
        public int DeleteMovie(string imdbID, string userID)
        {
            if (imdbID.Equals(string.Empty) || imdbID.Equals(""))
            {
                throw new ArgumentOutOfRangeException();
            }
            if (userID.Equals(string.Empty) || userID.Equals(""))
            {
                throw new ArgumentOutOfRangeException();
            }

            int i = 0;

            using (MySqlCommand command = new MySqlCommand())
            {
                i = ExecuteNonQuery(MovieExtendStringsMySql.DeleteMovie(imdbID, userID));
            }
            return(i);
        }