Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
 public void UpdateGenreInDB(ClassGenre inGenre)
 {
     ExecuteNonQuery($"UPDATE Genre SET genreType = '{inGenre.genre}' WHERE id = {inGenre.id}");
 }
Ejemplo n.º 4
0
 public void InsertGenreIntoDB(ClassGenre inGenre)
 {
     ExecuteNonQuery($"INSERT INTO Genre (genreType) VALUES('{inGenre.genre}')");
 }