예제 #1
0
        public async Task <IActionResult> MyPolls()
        {
            var currentUserId = (await _userManager.GetUserAsync(User)).Id;
            var model         = _polls.GetPollsByAuthorId(currentUserId)
                                .Select(poll => new PollsListViewModel
            {
                Id         = poll.PollId,
                Question   = poll.Question,
                TotalVotes = poll.Answers.Sum(answer => answer.Votes)
            }).ToList();

            return(View(model));
        }