コード例 #1
0
 public IActionResult ListarPorCliente(int idCliente)
 {
     try
     {
         List <Aluguel>      listaAlugueisDoCliente = _aluguelRepositorio.ListarPorCliente(idCliente);
         List <AluguelModel> listaAluguelModel      = listaAlugueisDoCliente != null && listaAlugueisDoCliente.Any() ?
                                                      _mapper.Map <List <Aluguel>, List <AluguelModel> >(listaAlugueisDoCliente) : new List <AluguelModel>();
         PreencherVeiculosAluguel(listaAluguelModel);
         return(Ok(listaAluguelModel));
     }
     catch (Exception)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, Constantes.Mensagens.ServicoIndisponivel));
     }
 }