private async Task AddToQueueAsync(Song song) { if (QueueSongs.Any(p => p.SongId == song.Id)) { return; } var prev = QueueSongs.LastOrDefault(); // Create the new queue entry var newQueue = new QueueSong { SongId = song.Id, PrevId = prev == null ? 0 : prev.Id, Song = song }; using (var bg = _bgFunc()) { await bg.InsertAsync(newQueue); if (prev != null) { prev.NextId = newQueue.Id; await bg.UpdateItemAsync(prev); } QueueSongsLookup.Add(newQueue.Id, newQueue); QueueSongs.Add(newQueue); } }
public bool Add(AllJoinedTable allJoinedTable) { if (!QueueSongs.Any(x => x == allJoinedTable)) { QueueSongs.Add(allJoinedTable); } else { return(false); } return(true); }