public async Task <Poll> Adicionar(Poll poll)
        {
            var caunt = 1;

            if (poll.Id == 0)
            {
                poll.Id = _pollRepository.GetAll().Result
                          .Count() == 0 ? 1 : _pollRepository.GetAll().Result.Count() + 1;
            }

            foreach (var opcao in poll.Options.ToList())
            {
                opcao.Id = caunt;
                caunt++;
            }

            if (!ExecutarValidacao(new PollValidation(), poll))
            {
                return(null);
            }

            await _pollRepository.Add(poll);

            return(poll);
        }
 public List <Poll> GetAll()
 {
     return(_pollRepository.GetAll());
 }
Ejemplo n.º 3
0
 public IEnumerable <Poll> GetAll()
 {
     return(_pollRepository.GetAll());
 }