コード例 #1
0
        public ActionResult UnVote(long id)
        {
            var user = userManager.ReadUser(User != null ? User.Identity.Name : testName);

            playlistManager.DeleteVote(id, user.Id);

            var playlistTrack = playlistManager.ReadPlaylistTrack(id);
            var playlistId    = playlistTrack.Playlist.Id;

            var viewmodel = new LivePlaylistTrackViewModel
            {
                Id    = playlistTrack.Id,
                Score = playlistTrack.Votes.Sum(v => v.Score),
                Track = playlistTrack.Track
            };

            var context = GlobalHost.ConnectionManager.GetHubContext <PlaylistHub>();

            context.Clients.Group(playlistId.ToString()).scoreUpdated(id, viewmodel);

            return(new HttpStatusCodeResult(200));
        }