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