public ActionResult Vote(TrackVoteViewModel model)
        {
            if (!this.ModelState.IsValid)
            {
                return this.Json(new { error = "Invalid vote values!" });
            }

            var vote = Mapper.Map<TrackVote>(model);
            var userId = this.User.Identity.GetUserId();
            vote.UserId = userId;
            try
            {
                this.votes.AddVote(vote);
            }
            catch (CustomServiceOperationException e)
            {
                return this.Json(new { error = e.Message });
            }

            var totalTrackVotes = this.votes.GetTrackVotesSum(model.TrackId);

            return this.Json(new { vote = totalTrackVotes });
        }
        public ActionResult Vote(TrackVoteViewModel model)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.Json(new { error = "Invalid vote values!" }));
            }

            var vote   = Mapper.Map <TrackVote>(model);
            var userId = this.User.Identity.GetUserId();

            vote.UserId = userId;
            try
            {
                this.votes.AddVote(vote);
            }
            catch (CustomServiceOperationException e)
            {
                return(this.Json(new { error = e.Message }));
            }

            var totalTrackVotes = this.votes.GetTrackVotesSum(model.TrackId);

            return(this.Json(new { vote = totalTrackVotes }));
        }