예제 #1
0
        private ClassGenre GetGenreFromDB(string inID)
        {
            DataTable  dt = DbReturnDataTable($"SELECT * FROM Genre WHERE id = {inID}");
            ClassGenre CG = new ClassGenre();

            foreach (DataRow row in dt.Rows)
            {
                CG.id    = row["id"].ToString();
                CG.genre = row["genreType"].ToString();
            }

            return(CG);
        }
예제 #2
0
        public ObservableCollection <ClassGenre> GetGenre()
        {
            ObservableCollection <ClassGenre> cGenre = new ObservableCollection <ClassGenre>();
            string    sqlQuery  = "SELECT * FROM Genre";
            DataTable dataTable = DbReturnDataTable(sqlQuery);

            foreach (DataRow row in dataTable.Rows)
            {
                ClassGenre genre = new ClassGenre();
                genre.genre = row["genreType"].ToString();
                genre.id    = row["id"].ToString();
                cGenre.Add(genre);
            }

            return(cGenre);
        }
예제 #3
0
 public void UpdateGenreInDB(ClassGenre inGenre)
 {
     ExecuteNonQuery($"UPDATE Genre SET genreType = '{inGenre.genre}' WHERE id = {inGenre.id}");
 }
예제 #4
0
 public void InsertGenreIntoDB(ClassGenre inGenre)
 {
     ExecuteNonQuery($"INSERT INTO Genre (genreType) VALUES('{inGenre.genre}')");
 }