public void addArtist(string name) { try { Artist veljko = new Artist("veljko"); veljko.addAlbum(new Album("albumslika","1992")); db.Store(veljko); db.Store(new Artist(name)); } catch (Exception e) { throw e; } }
public void addAlbum(string artist, string cdName, string cdYear) { Artist a = new Artist(artist); IObjectSet res = db.QueryByExample(a); if (res.Count == 0) { a.addAlbum(new Album(cdName, cdYear)); db.Store(a); } else { Artist art = (Artist)res.Next(); art.addAlbum(new Album(cdName, cdYear)); db.Store(art); } }
public List<Artist> listArtistsAndAlbums() { Artist a = new Artist(null); IObjectSet res = db.QueryByExample(a); List<Artist> artists = iterateOverResult(res); return artists; }