Ejemplo n.º 1
0
        public List <NotaFiscal> ObterTodos()
        {
            var listaNotas = _notaFiscalRepositorio.ObterTodos();

            if (listaNotas == null)
            {
                return(null);
            }

            foreach (var nota in listaNotas)
            {
                nota.Destinatario          = _destinatarioRepositorio.ObterPorId(nota.Destinatario.ID);
                nota.Destinatario.Endereco = _enderecoRepositorio.ObterPorId(nota.Destinatario.Endereco.ID);
            }

            foreach (var nota in listaNotas)
            {
                nota.Emitente          = _emitenteRepositorio.ObterPorId(nota.Emitente.ID);
                nota.Emitente.Endereco = _enderecoRepositorio.ObterPorId(nota.Emitente.Endereco.ID);
            }

            foreach (var nota in listaNotas)
            {
                nota.Transportador          = _transportadorRepositorio.ObterPorId(nota.Transportador.ID);
                nota.Transportador.Endereco = _enderecoRepositorio.ObterPorId(nota.Transportador.Endereco.ID);
            }

            return(listaNotas);
        }