예제 #1
0
        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;
            }
        }
예제 #2
0
 public List<TIPO> ListarTipo()
 {
     try
     {
         using (Contexto = new AlquilerEntities())
         {
             var Lista = Contexto.TIPO.ToList();
             return Lista;
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #3
0
 public List<DISTRITO> ListarDistrito()
 {
     try
     {
         using (Contexto = new AlquilerEntities())
         {
             var Lista = Contexto.DISTRITO.ToList();
             return Lista;
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #4
0
 public List<COLOR> ListarColor()
 {
     try
     {
         using (Contexto = new AlquilerEntities())
         {
             var Lista = Contexto.COLOR.ToList();
             return Lista;
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #5
0
        public List<MARCA> ListarMarca()
        {
            try
            {
                using (Contexto = new AlquilerEntities())
                {
                    var Lista = Contexto.MARCA.ToList();
                    return Lista;
                }

            }
            catch (Exception ex)
            {
               throw ex;
            }
        }
예제 #6
0
        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;
            }
        }
예제 #7
0
        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;
            }
        }
예제 #8
0
 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;
     }
 }
예제 #9
0
        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;
            }
        }