Example #1
0
        public async Task <IActionResult> GetCandidateVoteCount([FromRoute] int id)
        {
            if ((await _candidateManager.GetAsync(id)) != null)
            {
                var result = await _candidateManager.GetVotesCountForCandidate(id);

                return(new ContentActionResult <CandidateVoteInfoVM>(HttpStatusCode.OK, result, "OK", Request));
            }

            return(new ContentActionResult <CandidateVoteInfoVM>(HttpStatusCode.BadRequest, null, "Candidate Not Found", Request));
        }