public PartialViewResult GetVotes(VoteUpViewModel voteUpViewModel) { if (Request.IsAjaxRequest()) { var post = _postService.Get(voteUpViewModel.Post); var positiveVotes = post.Votes.Count(x => x.Amount > 0); var negativeVotes = post.Votes.Count(x => x.Amount <= 0); var viewModel = new ShowVotesViewModel { DownVotes = negativeVotes, UpVotes = positiveVotes}; return PartialView(viewModel); } return null; }
public PartialViewResult GetVotes(EntityIdViewModel voteUpViewModel) { if (Request.IsAjaxRequest()) { var post = _postService.Get(voteUpViewModel.Id); var positiveVotes = post.Votes.Count(x => x.Amount > 0); var negativeVotes = post.Votes.Count(x => x.Amount <= 0); var viewModel = new ShowVotesViewModel { DownVotes = negativeVotes, UpVotes = positiveVotes }; return(PartialView(viewModel)); } return(null); }