예제 #1
0
        public TrackWithFeelings NextTrack()
        {
            if (HasNextTrack())
            {
                TrackWithFeelings trackToReturn = _tracks.First();

                _tracks.RemoveAt(0);

                return(trackToReturn);
            }

            return(null);
        }
예제 #2
0
        public async Task UserLikesTrackAsync(PartyGoer user, string trackUri, string partyCode)
        {
            if (!_usersLikesDislikes.DoesUserLikeTrack(user, trackUri))
            {
                _usersLikesDislikes.UserLikesTrack(user, trackUri);

                TrackWithFeelings track = _tracks.Find(p => p.GetTrackWithoutFeelings().Id.Equals(trackUri, StringComparison.OrdinalIgnoreCase));

                if (track != null)
                {
                    track.UserLikesTrack();
                    _tracks.Sort(new ReorderQueueComparer());

                    await DomainEvents.RaiseAsync(new UpdateQueue { Tracks = _tracks.Select(p => p.GetTrackWithoutFeelings()).ToList(), PartyCode = partyCode });
                }
            }
        }