예제 #1
0
        public async Task <IActionResult> Index([FromQuery] VotesParams vp)
        {
            ICollection <Candidato> votes   = new List <Candidato>();
            ICollection <Voto>      nulls   = new List <Voto>();
            ICollection <Voto>      brancos = new List <Voto>();

            if (vp.Type < 3)
            {
                votes = await repo.GetVotos(vp);

                nulls = await repo.GetCountVotosNulos();

                brancos = await repo.GetCountVotosBrancos();
            }
            else if (vp.Type == 3)
            {
                nulls = await repo.GetCountVotosNulos();

                brancos = await repo.GetCountVotosBrancos();
            }


            return(Ok(new {
                votes,
                nulls,
                brancos
            }));
        }