public async Task <ActionResult> GetPolls([FromQuery] PollStatus status = PollStatus.Undefined)
        {
            IEnumerable <Poll> polls;

            if (status != PollStatus.Undefined)
            {
                _logger.LogInformation(LoggingEvents.GetPolls, "Listing all polls with status ({status})", status.ToString());
                polls = await _pollRepository.GetPollsByStatusAsync(status);
            }
            else
            {
                _logger.LogInformation(LoggingEvents.GetPolls, "Listing all polls");
                polls = await _pollRepository.GetAllPollsAsync();
            }

            return(Ok(polls));
        }
Exemple #2
0
 public Task <List <Poll> > Get()
 {
     _logger.Debug("Requesting all polls");
     return(_pollRepository.GetAllPollsAsync());
 }