Exemple #1
0
    public async Task <IActionResult> VotePie()
    {
        // save vote
        await voteManager.CastVote("pie");

        return(Ok());
    }
    public async Task <IActionResult> VotePie()
    {
        // save vote
        await voteManager.CastVote("pie");

        await hubContext.Clients.All.SendAsync("updateVotes", voteManager.GetCurrentVotes());

        return(Ok());
    }
        public async Task <IActionResult> CreateVote([FromBody] VoteVM model)
        {
            var result = await VoteManager.CastVote(model.CandidateId, model.CategoryId, model.VoterId);

            return(new ContentActionResult <string>(result ? HttpStatusCode.Created : HttpStatusCode.OK, result ? "Vote succesfully casted" : "Vote already casted", result ? "Created" : "OK", Request));
        }