public string Get([FromRoute] string formaRetorno, string numero)
        {
            var resultado   = new Retorno <string>();
            var pesquisaDto = new PesquisaDto()
            {
                FormaRetorno = formaRetorno, Numero = numero
            };

            Retorno <NotaFiscalRetornoTo> retorno = _notaFiscalRepository.ObterTodos(pesquisaDto.ToTransferObject());

            if (retorno.Status == ResultadoOperacao.Sucesso)
            {
                resultado.Status = ResultadoOperacao.Sucesso;

                if (Convert.ToInt32(pesquisaDto.FormaRetorno) == (int)TipoRetorno.Url)
                {
                    resultado.Objeto = retorno.Objeto.Url;
                }
                else if (Convert.ToInt32(pesquisaDto.FormaRetorno) == (int)TipoRetorno.Imagem)
                {
                    resultado.Objeto = retorno.Objeto.Imagem;
                }
            }
            else
            {
                resultado.Status = ResultadoOperacao.Falha;
                resultado.Mensagens.AddRange(retorno.Mensagens);
            }

            return(Newtonsoft.Json.JsonConvert.SerializeObject(resultado));
        }
Пример #2
0
 public IActionResult Get()
 {
     try
     {
         return(Ok(_notaFiscalRepository.ObterTodos()));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.ToString()));
     }
 }
 public async Task <IList <NotaFiscalViewModel> > GetAll()
 {
     return(_mapper.Map <IList <NotaFiscalViewModel> >(await _notaFiscalRepository.ObterTodos()));
 }