Exemple #1
0
        [HttpGet("GetShowByName/{showName}/")] //Route: WebAPI/TermProject/GetShowByName/
        public List <TVShows> GetTVShowByName(string showName)
        {
            DataSet          myDS    = new DataSet();
            StoredProcedures stoPros = new StoredProcedures();

            //string query = "SELECT * FROM TP_Actor";

            myDS = stoPros.getShowByName(showName);

            DBConnect objDB = new DBConnect();
            //DataSet ds = objDB.GetDataSet(query);

            TVShows        shows = new TVShows();
            List <TVShows> dpts  = new List <TVShows>();

            foreach (DataRow dr in myDS.Tables[0].Rows)
            {
                shows                 = new TVShows();
                shows.ShowID          = int.Parse(dr["TV_Show_ID"].ToString());
                shows.ShowImage       = dr["TV_Show_Image"].ToString();
                shows.ShowName        = dr["TV_Show_Name"].ToString();
                shows.ShowYears       = dr["TV_Show_Years"].ToString();
                shows.ShowAgeRating   = dr["TV_Show_Age_Rating"].ToString();
                shows.ShowRuntime     = int.Parse(dr["TV_Show_Runtime"].ToString());
                shows.ShowGenre       = dr["TV_Show_Genre"].ToString();
                shows.ShowDescription = dr["TV_Show_Description"].ToString();

                dpts.Add(shows);
            }
            return(dpts);
        } //end of GetTVShows
Exemple #2
0
        public Boolean AddShow([FromBody] TVShows show)
        {
            if (show != null)
            {
                DBConnect  objDB      = new DBConnect();
                SqlCommand objCommand = new SqlCommand();

                objCommand.CommandType = CommandType.StoredProcedure;
                objCommand.CommandText = "TP_AddShow";
                objCommand.Parameters.AddWithValue("@Member_ID", show.MemberID);

                objCommand.Parameters.AddWithValue("@Show_Image", show.ShowImage);
                objCommand.Parameters.AddWithValue("@Show_Name", show.ShowName);
                objCommand.Parameters.AddWithValue("@Show_Years", show.ShowYears);
                objCommand.Parameters.AddWithValue("@Show_Description", show.ShowDescription);
                objCommand.Parameters.AddWithValue("@Show_Runtime", show.ShowRuntime);
                objCommand.Parameters.AddWithValue("@Show_Age_Rating", show.ShowAgeRating);
                objCommand.Parameters.AddWithValue("@Show_Genre", show.ShowGenre);

                int retVal = objDB.DoUpdateUsingCmdObj(objCommand);

                if (retVal > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Exemple #3
0
        [HttpGet("GetShows")] //Route: WebAPI/TermProject/GetShows/
        public List <TVShows> GetShows()
        {
            DataSet          myDS    = new DataSet();
            StoredProcedures stoPros = new StoredProcedures();

            myDS = stoPros.getAllShows();

            DBConnect objDB = new DBConnect();

            TVShows        shows = new TVShows();
            List <TVShows> dpts  = new List <TVShows>();

            foreach (DataRow dr in myDS.Tables[0].Rows)
            {
                shows                 = new TVShows();
                shows.ShowID          = int.Parse(dr["TV_Show_ID"].ToString());
                shows.ShowImage       = dr["TV_Show_Image"].ToString();
                shows.ShowName        = dr["TV_Show_Name"].ToString();
                shows.ShowYears       = dr["TV_Show_Years"].ToString();
                shows.ShowAgeRating   = dr["TV_Show_Age_Rating"].ToString();
                shows.ShowRuntime     = int.Parse(dr["TV_Show_Runtime"].ToString());
                shows.ShowGenre       = dr["TV_Show_Genre"].ToString();
                shows.ShowDescription = dr["TV_Show_Description"].ToString();

                dpts.Add(shows);
            }
            return(dpts);
        }