public static int AgregarVuelo(AE_VUELOS vuelo) { AeropuertoEntities contexto = null; try { contexto = new AeropuertoEntities(); contexto.AE_VUELOS.Add(vuelo); contexto.SaveChanges(); } catch (Exception ex) { throw ex; } finally { if (contexto != null) { contexto.Dispose(); } } return(1); }
public void PruebaUpdate() { // using (AeropuertoEntities context = new AeropuertoEntities()) { try { var vuelo = context.Vuelos.Where(x => x.Duracion == 5).SingleOrDefault(); vuelo.Escala = "CAMBIO"; context.SaveChanges(); var Aviones = context.Aviones.Where(x => x.Cantidad == 1).SingleOrDefault(); Aviones.Asientos = "CAMBIO"; context.SaveChanges(); var Pasajeros = context.Pasajeros.Where(x => x.Id_vuelo == 4).SingleOrDefault(); Pasajeros.Nombre = "CAMBIO"; context.SaveChanges(); var PaisesDestinoAeropuerto = context.Paises_Destino_Aeropuerto.Where(x => x.Tarifa == 1).SingleOrDefault(); PaisesDestinoAeropuerto.Destino = "CAMBIO"; context.SaveChanges(); } catch (Exception e) { Console.WriteLine(" prueba Update vuelo e"); } } }
public static int AgregarEscalaVu(AE_ESCALAS_VUELOS escala) { AeropuertoEntities contexto = null; try { contexto = new AeropuertoEntities(); contexto.AE_ESCALAS_VUELOS.Add(escala); contexto.SaveChanges(); } catch (Exception ex) { throw ex; } finally { if (contexto != null) { contexto.Dispose(); } } return(1); }
public static int AgregarReservaBo(AE_PAGO_BOLETO reserva) { AeropuertoEntities contexto = null; try { contexto = new AeropuertoEntities(); contexto.AE_PAGO_BOLETO.Add(reserva); contexto.SaveChanges(); } catch (Exception ex) { throw ex; } finally { if (contexto != null) { contexto.Dispose(); } } return(1); }
public static int AgregarBoletosAv(AE_BOLETOS_AVION boleto) { AeropuertoEntities contexto = null; try { contexto = new AeropuertoEntities(); contexto.AE_BOLETOS_AVION.Add(boleto); contexto.SaveChanges(); } catch (Exception ex) { throw ex; } finally { if (contexto != null) { contexto.Dispose(); } } return(1); }
public static int AgregarCompania(AE_COMPANIA compania) { AeropuertoEntities contexto = null; try { contexto = new AeropuertoEntities(); contexto.AE_COMPANIA.Add(compania); contexto.SaveChanges(); } catch (Exception ex) { throw ex; } finally { if (contexto != null) { contexto.Dispose(); } } return(1); }
public void PruebaSelect() { using (AeropuertoEntities context = new AeropuertoEntities()) { var vuelos = context.Vuelos.ToList(); } }
public void AddVuelo(Vuelos v1) { using (AeropuertoEntities context = new AeropuertoEntities()) { context.Vuelos.Add(v1); context.SaveChanges(); } }
public void AddAvion(Aviones A1) { using (AeropuertoEntities context = new AeropuertoEntities()) { context.Aviones.Add(A1); context.SaveChanges(); } }
public void AddPasajero(Pasajeros P1) { using (AeropuertoEntities context = new AeropuertoEntities()) { context.Pasajeros.Add(P1); context.SaveChanges(); } }
public void PruebaSelect() { using (AeropuertoEntities context = new AeropuertoEntities()) { var vuelos = context.Vuelos.ToList(); var aviones = context.Aviones.ToList(); var pasajeros = context.Pasajeros.ToList(); var PaisesDestinoAeropuerto = context.Paises_Destino_Aeropuerto.ToList(); } }
public void AgregarAviones() { using (AeropuertoEntities context = new AeropuertoEntities()) { var A1 = new Aviones(); A1.Asientos = "45"; A1.Cantidad = 4; A1.Modelo = "ABCFGJJ"; bl.AddAvion(A1); } }
public void Agregarvuelo() { using (AeropuertoEntities context = new AeropuertoEntities()) { var v1 = new Vuelos(); v1.Duracion = 0; v1.Escala = "s"; v1.Round_trip = true; v1.Tipo = "s"; bl.AddVuelo(v1); } }
public void AgregarVuelos() { Vuelos v = new Vuelos(); v.Escala = "xxx"; v.Duracion = 5; v.Id_vuelo = 2; using (AeropuertoEntities context = new AeropuertoEntities()) { context.Vuelos.Add(v); context.SaveChanges(); } }
public void Prueba1() { Vuelos v1 = new Vuelos(); v1.Duracion = 5; v1.Escala = "xxx"; using (AeropuertoEntities context = new AeropuertoEntities()) { context.Vuelos.Add(v1); context.SaveChanges(); } }
public void PruebaSelect3() { using (AeropuertoEntities context = new AeropuertoEntities()) { try { var vuelos = context.Vuelos.Where(x => x.Id_vuelo == 4).ToList(); } catch (Exception ex) { Console.WriteLine("Error: " + ex.Message); } } }
//public void SelectAvion() //{ // using (AeropuertoEntities context = new AeropuertoEntities()) // try // { // var vuelos = context.AE_TIPOS_AVIONES.Where(x => x.id == 1).Select(e => new { xxx = e.desc_avion }); // Console.WriteLine(xxx); // } // catch (Exception exp) // { // Console.WriteLine("Error: " + exp.Message); // } //} public static void EliminarAvion() { using (AeropuertoEntities context = new AeropuertoEntities()) try { var vuelo = context.AE_TIPOS_AVIONES.Where(x => x.id == 1).SingleOrDefault(); context.AE_TIPOS_AVIONES.Remove(vuelo); context.SaveChanges(); } catch (Exception exp) { Console.WriteLine("Error: " + exp.Message); } }
///////////////////////////// public void ModificarAvion() { using (AeropuertoEntities context = new AeropuertoEntities()) try { var vuelo = context.AE_TIPOS_AVIONES.Where(x => x.id == 1).SingleOrDefault(); vuelo.desc_avion = "cambio"; context.SaveChanges(); } catch (Exception exp) { Console.WriteLine("Error: " + exp.Message); } }
public void PruebaWhere2() { using (AeropuertoEntities context = new AeropuertoEntities()) { try { var vuelos = context.Vuelos.Where(x => x.Duracion == 5); } catch (Exception e) { Console.WriteLine("e"); } } }
public void AgregarAviones() { Aviones a = new Aviones(); a.Modelo = "789-9 Dreamliner"; a.Asientos = "217-323"; a.Cantidad = 200; using (AeropuertoEntities context = new AeropuertoEntities()) { context.Aviones.Add(a); context.SaveChanges(); } }
public void Prueba1() { Vuelos vl = new Vuelos(); vl.Duracion = 5; vl.Escala = "XXX"; using (AeropuertoEntities context = new AeropuertoEntities()) { //var vuelos = Context.Vuelos.ToList(); context.Vuelos.Add(vl); context.SaveChanges(); } }
public void remove() { using (AeropuertoEntities context = new AeropuertoEntities()) { try { var vuelo = context.Vuelos.Where(x => x.Id_vuelo == 1).FirstOrDefault(); context.Vuelos.Remove(vuelo); context.SaveChanges(); } catch (Exception exp) { Console.WriteLine("ERROR: " + exp.Message); } } }
public void AgregarPaisesDestinoAeropuerto() { Paises_Destino_Aeropuerto pda = new Paises_Destino_Aeropuerto(); pda.id_vuelo = 1; pda.Paises = "Canada"; pda.Destino = " Ottawa"; pda.Aeropuerto = "Aeropuerto Internacional Toronto Pearson"; pda.Tarifa = 322.616; using (AeropuertoEntities context = new AeropuertoEntities()) { context.Paises_Destino_Aeropuerto.Add(pda); context.SaveChanges(); } }
public void AgregarPasajeros() { Pasajeros p = new Pasajeros(); p.Id_vuelo = 123456; p.Nombre = "Juan"; p.Apellidos = "Ortiz"; p.Visa = 0123456; p.Pasaporte = 005123456; using (AeropuertoEntities context = new AeropuertoEntities()) { context.Pasajeros.Add(p); context.SaveChanges(); } }
public Vuelos where_practica(int id) { using (AeropuertoEntities context = new AeropuertoEntities()) { try { //var es una variable no tipificada, esta toma la forma al momento de la asignacion var vuelo = context.Vuelos.Where(x => x.Id_vuelo == id).SingleOrDefault(); return(vuelo); } catch (Exception exp) { Console.WriteLine("ERROR: " + exp.Message); } return(null); } }
public void PruebaUpdate() { // using (AeropuertoEntities context = new AeropuertoEntities()) { try { var vuelo = context.Vuelos.Where(x => x.Duracion == 5).SingleOrDefault(); vuelo.Escala = "CAMBIO"; context.SaveChanges(); } catch (Exception e) { Console.WriteLine("e"); } } }
public void Insertar() { Vuelos v1 = new Vuelos(); v1.Id_vuelo = 5; v1.Escala = "xxx"; v1.Duracion = 5; Aviones A1 = new Aviones(); A1.Id = 4; A1.Modelo = "Airbus456"; A1.Asientos = "568"; A1.Cantidad = 684; Paises_Destino_Aeropuerto PDA = new Paises_Destino_Aeropuerto(); PDA.id = 6; PDA.id_vuelo = 5; PDA.Paises = "USA"; PDA.Destino = "New York"; PDA.Aeropuerto = "Juan Santa Maria "; PDA.Tarifa = 564; Pasajeros pj = new Pasajeros(); pj.id = 8; pj.Id_vuelo = 5; pj.Nombre = "Nombre 1"; pj.Apellidos = "Apellidos 1"; pj.Visa = 454221; pj.Pasaporte = 26564; using (AeropuertoEntities context = new AeropuertoEntities()) { context.Vuelos.Add(v1); context.SaveChanges(); } }
public void UpdateVuelo() { using (AeropuertoEntities context = new AeropuertoEntities()) { try { var vuelo = context.Vuelos.Where(x => x.Id_vuelo == 1).SingleOrDefault(); vuelo.Escala = "Actualizado"; //context.Entry(vuelo).State = System.Data.Entity.EntityState.Modified; // le estoy diciendo al entity que fue cambiado context.SaveChanges(); // cambio } catch (Exception exp) { Console.WriteLine("ERROR: " + exp.Message); } } }
public void AgregarPasajeros() { using (AeropuertoEntities context = new AeropuertoEntities()) { try { var P1 = new Pasajeros(); P1.Id_vuelo = 0; P1.Apellidos = "Badilla"; P1.Nombre = "Jeison"; P1.Pasaporte = 23; P1.Visa = 111; bl.AddPasajero(P1); } catch (Exception exp) { Console.WriteLine("ERROR: " + exp.Message); } } }
public void PruebaWhereSelect() { //T lambda es una funcion en este ejemplo s es esa funcion sx tiene la misma función using (AeropuertoEntities context = new AeropuertoEntities()) { try { var vuelos = context.Vuelos.Where(x => x.Duracion == 5).Select(s => new { Escala = s.Escala, Duracion = s.Duracion } ).ToList(); } catch (Exception e) { Console.WriteLine("e"); } } }