Пример #1
0
 public static void guardarVuelo(VuelosForm vuelo)
 {
     using (var ctx = new VuelosEntities1())
     {
         using (var dbContextTransaction = ctx.Database.BeginTransaction())
         {
             try
             {
                 Vuelo v = new Vuelo();
                 v.NumeroDeVuelo  = vuelo.numeroDeVuelo;
                 v.HorarioLlegada = vuelo.horaLlegada;
                 v.Demorado       = vuelo.demorado;
                 v.IDLineaAerea   = vuelo.lineaAerea;
                 ctx.Vuelo.Add(v);
                 ctx.SaveChanges();
                 dbContextTransaction.Commit();
             }
             catch (Exception e)
             {
                 dbContextTransaction.Rollback();
                 throw e;
             }
         }
     }
 }
Пример #2
0
 public static void eliminarVuelo(int id)
 {
     using (var ctx = new VuelosEntities1())
     {
         using (var dbContextTransaction = ctx.Database.BeginTransaction())
         {
             try
             {
                 var v = ctx.Vuelo.Find(id);
                 ctx.Vuelo.Remove(v);
                 ctx.SaveChanges();
                 dbContextTransaction.Commit();
             }
             catch (Exception e)
             {
                 dbContextTransaction.Rollback();
                 throw e;
             }
         }
     }
 }
Пример #3
0
        public static Vuelo traerVueloPorID(int id)
        {
            VuelosEntities1 ctx = new VuelosEntities1();

            return(ctx.Vuelo.Find(id));
        }
Пример #4
0
        public static List <Vuelo> traerTodos()
        {
            VuelosEntities1 ctx = new VuelosEntities1();

            return(ctx.Vuelo.ToList());
        }
Пример #5
0
        public static List <LineaAerea> traerTodas()
        {
            var ctx = new VuelosEntities1();

            return(ctx.LineaAerea.ToList());
        }