BB.UI.Web.MVC.Controllers.PlaylistController.AddVote C# (CSharp) Метод

AddVote() приватный Метод

private AddVote ( int vote, long id ) : System.Web.Mvc.ActionResult
vote int
id long
Результат System.Web.Mvc.ActionResult
        public ActionResult AddVote(int vote, long id)
        {
            var user = userManager.ReadUser(User != null ? User.Identity.Name : testName);
            var createdVote = playlistManager.CreateVote(vote, user.Id, id);
            if (createdVote == null) return new HttpStatusCodeResult(400, "You have reached your vote limit for this playlist");

            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);
        }