Ejemplo n.º 1
0
        public async Task <ActionResult> Index()
        {
            var model    = new VoteSummaryModel();
            var userId   = GetCurrentUserId();
            var hasVoted = await _voteService.HasVoted(userId);

            model.HasVoted = hasVoted;
            var candidates = await _candidateService.GetAllCandidates();

            model.Candidates = candidates;

            return(View(model));
        }
 public static string toJson(this VoteSummaryModel model)
 {
     return(JsonSerializer.Serialize(model));
 }