Example #1
0
        public async Task UserModifiedPlaylist(RearrangeQueueRequest queueRequest)
        {
            var  partier = new PartyGoer(Context.UserIdentifier);
            bool successfullyRearrangedQueue = await _partyService.RearrangeQueue(queueRequest);

            if (successfullyRearrangedQueue)
            {
                Party party = await _partyService.GetPartyWithAttendeeAsync(partier);

                // Update the view of the partier to the current playlist
                await Clients.Group(party.PartyCode).SendAsync("UpdatePartyView",
                                                               new
                {
                    Song     = party.Playlist.CurrentSong,
                    Position = party.Playlist.CurrentPositionInSong()
                },
                                                               party.Playlist.History,
                                                               party.Playlist.Queue
                                                               );
            }
            else
            {
                await Clients.Client(Context.ConnectionId).SendAsync("UserModifiedPlaylist", new { error = true });
            }
        }
Example #2
0
        public async Task <bool> RearrangeQueue(RearrangeQueueRequest request)
        {
            try
            {
                Party party = await _partyRepository.GetPartyWithCode(request.PartyCode);

                await party.ModifyPlaylistAsync(request);

                return(true);
            }
            catch (Exception ex)
            {
                await _logService.LogExceptionAsync(ex, "Error occured in RearrangeQueue");

                return(false);
            }
        }