public int Alterar()
 {
     try
     {
         using (veiculosapiContext contexto = new veiculosapiContext())
         {
             TipoCombustivel tipoCombustivel = contexto.TipoCombustivel.Where(p => p.Id == this.Id).FirstOrDefault();
             tipoCombustivel.Nome = this.Nome;
             contexto.TipoCombustivel.Attach(tipoCombustivel);
             return(contexto.SaveChanges());
         }
     }
     catch (Exception ex)
     {
         return(-1);
     }
 }
 public int Excluir(int id)
 {
     try
     {
         using (veiculosapiContext contexto = new veiculosapiContext())
         {
             Veiculo veiculo = contexto.Veiculo.Where(p => p.TipoCombustivelId == id).FirstOrDefault();
             if (veiculo == null)
             {
                 TipoCombustivel tipoCombustivel = contexto.TipoCombustivel.Where(p => p.Id == id).FirstOrDefault();
                 contexto.TipoCombustivel.Remove(tipoCombustivel);
                 return(contexto.SaveChanges());
             }
             return(-99);
         }
     }
     catch (Exception ex)
     {
         return(-1);
     }
 }