Ejemplo n.º 1
0
        public async Task <bool> SendSinglePollAnswer(Poll poll, Answer answer, IPollHubService pollHubService)
        {
            var resp = await _httpClient.PutAsync($"/api/polls/{poll.Id}/vote-single/{answer.Id}", GetStringContent(answer));

            if (resp.IsSuccessStatusCode)
            {
                var updatedPoll = await FindPollById(poll.Id);

                await pollHubService.Send(updatedPoll);
            }

            return(resp.IsSuccessStatusCode);
        }
Ejemplo n.º 2
0
        public async Task <bool> SendMultiplePollAnswers(Poll poll, List <Answer> answers, IPollHubService pollHubService)
        {
            var ids = GetIdArrayFromAnswerList(answers);

            var resp = await _httpClient.PutAsync($"/api/polls/{poll.Id}/vote-multiple", GetStringContent(ids));

            if (resp.IsSuccessStatusCode)
            {
                var updatedPoll = await FindPollById(poll.Id);

                await pollHubService.Send(updatedPoll);
            }

            return(resp.IsSuccessStatusCode);
        }