public ActionResult GetById(int id) { var endereco = _repositorio.ObterPorId(id); if (endereco == null) { return(NotFound()); } return(Ok(endereco)); }
public void Endereco_InfraData_PegarPorID_EsperadoOK() { //cenário BaseSqlTeste.SemearBancoParaEndereco(); _endereco.ID = 1; //Ação Endereco endereco = _enderecoRepositorio.ObterPorId(_endereco.ID); //Verificação endereco.Should().NotBeNull(); endereco.ID.Should().Be(_endereco.ID); }
public void InfraData_Deletar_deve_deletar_um_endereco() { //Cenário int idPesquisa = 1; Endereco cliente = _enderecoRepositorio.ObterPorId(idPesquisa); //Ação _enderecoRepositorio.Deletar(cliente); //Verifica Endereco resultado = _enderecoRepositorio.ObterPorId(idPesquisa); resultado.Should().BeNull(); }
public async Task <ActionResult> ObterPorId(int EnderecoId) { try { var enderecos = await _enderecoRepositorio.ObterPorId(EnderecoId); var results = _mapper.Map <EnderecoDto>(enderecos); return(Ok(results)); } catch (System.Exception ex) { return(this.StatusCode(StatusCodes.Status500InternalServerError, $"Banco de Dados Falou {ex.Message}")); } }
public Destinatario ObterPorId(long id) { if (id <= 0) { throw new ExcecaoIdentificadorInvalido(); } var destinatario = _destinatarioRepositorio.ObterPorId(id); if (destinatario == null) { return(null); } destinatario.Endereco = _enderecoRepositorio.ObterPorId(destinatario.Endereco.ID); return(destinatario); }
public Transportador ObterPorId(long id) { if (id <= 0) { throw new ExcecaoIdentificadorInvalido(); } var transportador = _transportadorRepositorio.ObterPorId(id); if (transportador == null) { return(null); } transportador.Endereco = _enderecoRepositorio.ObterPorId(transportador.Endereco.ID); return(transportador); }
public Endereco ObterPorId(long id) { if (id <= 0) { throw new ExcecaoIdentificadorInvalido(); } return(_enderecoRepositorio.ObterPorId(id)); }
public Emitente ObterPorId(long id) { if (id < 1) { throw new ExcecaoIdentificadorInvalido(); } var emitente = _emitenteRepositorio.ObterPorId(id); if (emitente == null) { return(null); } emitente.Endereco = _enderecoRepositorio.ObterPorId(emitente.Endereco.ID); return(emitente); }
public void Endereco_Integracao_Inserir_EsperadoOK() { _endereco = EnderecoObjetoMae.ObterValido(); var endereco = _enderecoServico.Inserir(_endereco); var enderecoInserido = _enderecoRepositorio.ObterPorId(endereco.ID); enderecoInserido.ID.Should().Be(endereco.ID); endereco.Numero.Should().Be(_endereco.Numero); }
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); }
public async Task <EnderecoViewModel> ObterEnderecoPorId(Guid id) { return(_mapper.Map <EnderecoViewModel>(await _enderecoRepositorio.ObterPorId(id))); }
public async Task <Endereco> ObterPorIdAsync(Guid Id) { return(await enderecoRepositorio.ObterPorId(Id)); }
public Endereco ObterEnderecoPorId(Guid id) { return(_enderecoRepositorio.ObterPorId(id)); }