/// <summary> /// Updates the specified song in the database /// </summary> /// <param name="conn">Open connection to the database</param> /// <param name="song">Song object being updated in the database</param> public static void UpdateSong(SqlConnection conn, Business.Song song) { try { SqlDbObject.ExecuteNonQuery("UpdateSong", CommandType.StoredProcedure, song.GetMediaItemParametersForStoredProcedure(true), conn); } catch (System.Exception e) { throw new UpdateSqlDbObjectException("Could not update song in database", e); } }
/// <summary> /// Adds the specified song to the database and returns the Id that was generated /// </summary> /// <param name="conn">Open connection to the database</param> /// <param name="song">Song object being added to the database</param> /// <returns>New unique identifier of the song</returns> public static Int64 AddSong(SqlConnection conn, Business.Song song) { try { return((Int64)SqlDbObject.ExecuteScalar("AddSong", CommandType.StoredProcedure, song.GetMediaItemParametersForStoredProcedure(false), conn)); } catch (System.Exception e) { throw new AddSqlDbObjectException("Could not add song to database", e); } }