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); }
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); }