Пример #1
0
 public Models.VehiculosDuenos NombreDueno(int idVehiculo, int idDueno)
 {
     Models.VehiculosDuenos vehiculoDueno = new Models.VehiculosDuenos();
     try
     {
         using (var db = new BDEvaluacionVehiculosEntities())
         {
             var nombreDueno = (from oVehiculo in db.Vehiculo
                                join oDueno in db.Dueno
                                on oVehiculo.IdDueno equals oDueno.IdDueno
                                where oVehiculo.IdDueno == idDueno && oVehiculo.IdVehiculo == idVehiculo
                                select new Models.VehiculosDuenos()
             {
                 IdVehiculo = oVehiculo.IdVehiculo,
                 IdDueno = oDueno.IdDueno,
                 Nombre = oDueno.Nombre,
                 Apellido = oDueno.Apellido,
                 Patente = oVehiculo.Patente,
                 Marca = oVehiculo.Marca,
                 Modelo = oVehiculo.Modelo,
                 Anno = oVehiculo.Anno,
                 PrecioEnUF = oVehiculo.PrecioEnUF
             }).FirstOrDefault();
             vehiculoDueno = nombreDueno;
         }
         return(vehiculoDueno);
     }
     catch (Exception)
     {
         return(new Models.VehiculosDuenos());
     }
 }
Пример #2
0
        public Models.VehiculosDuenos BuscarVehiculoVista(string patente)
        {
            Models.VehiculosDuenos vehiculo = new Models.VehiculosDuenos();

            try
            {
                using (var db = new DataModels.BDEvaluacionVehiculosEntities())
                {
                    var query = (from oVehiculo in db.Vehiculo
                                 join oDueno in db.Dueno
                                 on oVehiculo.IdDueno equals oDueno.IdDueno
                                 where oVehiculo.Patente == patente
                                 select new Models.VehiculosDuenos()
                    {
                        IdVehiculo = oVehiculo.IdVehiculo,
                        IdDueno = oDueno.IdDueno,
                        Nombre = oDueno.Nombre,
                        Apellido = oDueno.Apellido,
                        Patente = oVehiculo.Patente,
                        Marca = oVehiculo.Marca,
                        Modelo = oVehiculo.Modelo,
                        Anno = oVehiculo.Anno,
                        PrecioEnUF = oVehiculo.PrecioEnUF
                    }).First();
                    vehiculo = query;
                }

                return(vehiculo);
            }
            catch (Exception)
            {
                return(new Models.VehiculosDuenos());
            }
        }
Пример #3
0
        public Models.VehiculosDuenos BuscarVehiculoVenta(int id)
        {
            Models.VehiculosDuenos vehiculo = new Models.VehiculosDuenos();
            try
            {
                using (var db = new BDEvaluacionVehiculosEntities())
                {
                    var queryvehiculo = (from oVehiculo in db.Vehiculo
                                         join oDueno in db.Dueno
                                         on oVehiculo.IdDueno equals oDueno.IdDueno
                                         where oVehiculo.IdVehiculo == id
                                         select new Models.VehiculosDuenos()
                    {
                        IdVehiculo = oVehiculo.IdVehiculo,
                        IdDueno = oDueno.IdDueno,
                        Patente = oVehiculo.Patente,
                        Marca = oVehiculo.Marca,
                        Modelo = oVehiculo.Modelo,
                        Anno = oVehiculo.Anno,
                        PrecioEnUF = oVehiculo.PrecioEnUF
                    }).FirstOrDefault();

                    vehiculo = queryvehiculo;
                }
                return(vehiculo);
            }
            catch (Exception)
            {
                return(new Models.VehiculosDuenos());
            }
        }
 public ActionResult DetallesVehiculo(int id)
 {
     DataModels.ManagerVehiculos managerVehiculos       = new DataModels.ManagerVehiculos();
     DataModels.Vehiculo         vehiculo               = managerVehiculos.BuscarVehiculo(id);
     Models.VehiculosDuenos      detallesVehiculosDueno = managerVehiculos.NombreDueno(vehiculo.IdVehiculo, vehiculo.IdDueno);
     return(View(detallesVehiculosDueno));
 }
Пример #5
0
 public ActionResult DetalleVenta(Models.VehiculosDuenos model)
 {
     DataModels.ManagerVenta man   = new DataModels.ManagerVenta();
     DataModels.Ventas       venta = man.CrearVistaVenta(model.IdDueno, model.IdVehiculo);
     if (venta.TotalVenta != 0)
     {
         return(View(venta));
     }
     else
     {
         TempData["MensajeVentaError"] = "Hay Problemas con el servicio inténtelo más tarde";
         return(RedirectToAction("Index"));
     }
 }
 public ActionResult BuscarVehiculo(string patente)
 {
     DataModels.ManagerVehiculos managerVehiculo = new DataModels.ManagerVehiculos();
     Models.VehiculosDuenos      vehiculoDueno   = managerVehiculo.BuscarVehiculoVista(patente);
     if (vehiculoDueno.IdVehiculo != 0)
     {
         return(View(vehiculoDueno));
     }
     else
     {
         TempData["MensajeErrorVehiculo"] = "Vehículo no encontrado";
         return(RedirectToAction("Index"));
     }
 }
Пример #7
0
 public PartialViewResult DetallesVehiculo(int id)
 {
     DataModels.ManagerVenta manVenta = new DataModels.ManagerVenta();
     Models.VehiculosDuenos  vehiculo = manVenta.BuscarVehiculoVenta(id);
     return(PartialView("_TablaVehiculo", vehiculo));
 }