public bool Eliminar(int pIdVehiculo) { try { using (Contexto = new AlquilerEntities()) { var oVehiculo = Contexto.VEHICULO.FirstOrDefault(t => t.IdVehiculo == pIdVehiculo); if (oVehiculo != null) { oVehiculo.Estado = "E"; Contexto.VEHICULO.Attach(oVehiculo); var vResult = Contexto.SaveChanges(); if (vResult > 0) return true; else return false; } else throw new Exception("No existe el registro Vehiculo para Eliminar"); } } catch (Exception ex) { throw ex; } }
public List<TIPO> ListarTipo() { try { using (Contexto = new AlquilerEntities()) { var Lista = Contexto.TIPO.ToList(); return Lista; } } catch (Exception ex) { throw ex; } }
public List<DISTRITO> ListarDistrito() { try { using (Contexto = new AlquilerEntities()) { var Lista = Contexto.DISTRITO.ToList(); return Lista; } } catch (Exception ex) { throw ex; } }
public List<COLOR> ListarColor() { try { using (Contexto = new AlquilerEntities()) { var Lista = Contexto.COLOR.ToList(); return Lista; } } catch (Exception ex) { throw ex; } }
public List<MARCA> ListarMarca() { try { using (Contexto = new AlquilerEntities()) { var Lista = Contexto.MARCA.ToList(); return Lista; } } catch (Exception ex) { throw ex; } }
public bool Agregar(ref VEHICULO oVEHICULO) { try { using (Contexto = new AlquilerEntities()) { Contexto.VEHICULO.Add(oVEHICULO); var vResult = Contexto.SaveChanges(); if (vResult > 0) return true; else return false; } } catch (Exception ex) { throw ex; } }
public List<VEHICULO> ListaVehiculo() { try { //int idMarca = 0; //int idTipo = 0; //int.TryParse(strMarca,out idMarca); //int.TryParse(strTipo, out idTipo); using (Contexto = new AlquilerEntities()) { var oListaVehiculo = Contexto.VEHICULO.ToList(); return oListaVehiculo; } } catch (Exception ex) { throw ex; } }
public bool Modificar(ref VEHICULO oVEHICULO) { try { using (Contexto = new AlquilerEntities()) { Contexto.Entry(oVEHICULO).State = System.Data.Entity.EntityState.Modified; var vResult = Contexto.SaveChanges(); if (vResult > 0) return true; else return false; } } catch (Exception ex) { throw ex; } }
public VEHICULO Obtener(int pIdVehiculo) { try { using (Contexto = new AlquilerEntities()) { var oVehiculo = Contexto.VEHICULO.FirstOrDefault(t => t.IdVehiculo == pIdVehiculo); if (oVehiculo != null) return oVehiculo; else throw new Exception("No existe el registro Vehículo"); } } catch (Exception ex) { throw ex; } }