Ejemplo n.º 1
0
        public NotaFiscal ObterPorId(long id)
        {
            if (id < 1)
            {
                throw new ExcecaoIdentificadorInvalido();
            }

            var nota = _notaFiscalRepositorio.ObterPorId(id);

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

            nota.Destinatario          = _destinatarioRepositorio.ObterPorId(nota.Destinatario.ID);
            nota.Destinatario.Endereco = _enderecoRepositorio.ObterPorId(nota.Destinatario.Endereco.ID);

            nota.Emitente          = _emitenteRepositorio.ObterPorId(nota.Emitente.ID);
            nota.Emitente.Endereco = _enderecoRepositorio.ObterPorId(nota.Emitente.Endereco.ID);

            nota.Transportador          = _transportadorRepositorio.ObterPorId(nota.Transportador.ID);
            nota.Transportador.Endereco = _enderecoRepositorio.ObterPorId(nota.Transportador.Endereco.ID);

            return(nota);
        }