Example #1
0
 public void RemoverVeiculoPorId(long?id)
 {
     try
     {
         Veiculo veiculo = ObterVeiculoPorId(id);
         if (veiculo.EstadoDoVeiculo == EstadosDeVeiculo.ALUGADO)
         {
             throw new Exception("Veiculo se encontra alugado no momento");
         }
         if (veiculo.EstadoDoVeiculo == EstadosDeVeiculo.EM_VIAGEM)
         {
             throw new Exception("Veiculo se encontra em viagem no momento");
         }
         Context.RemoverVeiculoPorId(id);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }