public Album SaveItem(Album album) { SqlParameter[] parameter = { new SqlParameter("title", SqlDbType.VarChar, 50) { Value = album.Title }, new SqlParameter("artist", SqlDbType.VarChar, 50) { Value = album.Artist } }; var sqlInsertAlbum = $"INSERT INTO albums (title, artist) VALUES (\"{parameter[0].Value}\", \"{parameter[1].Value}\" )"; RepoInterface <Album> repoInterface = this; int id = repoInterface.InsertIntoDB(sqlInsertAlbum); album.AlbumId = id; if (album.SongList != null) { foreach (Song song in album.SongList) { song.AlbumId = album.AlbumId; _songRepo.SaveItem(song); } } return(album); }
public Song CreateNewItem(Song song) { var savedSong = _songRepo.SaveItem(song); return(savedSong); }