Beispiel #1
0
        public int Guardar(Air air)
        {
            int rsp = 0;

            using (BDAEntities1 bd = new BDAEntities1())
            {
                bd.Air.Add(air);
                rsp = bd.SaveChanges();
            }
            return(rsp);
        }
        public int EliminarDato(Air air)
        {
            int rsp = 0;

            using (BDAEntities1 bd = new BDAEntities1())
            {
                Air _air = bd.Air.Find(air.a);

                bd.Air.Remove(_air);
                rsp = bd.SaveChanges();
            }
            return(rsp);
        }
        public int ModificarDatos(Air air)
        {
            int rsp = 0;

            using (BDAEntities1 bd = new BDAEntities1())
            {
                Air _air = bd.Air.Where(d => d.a == air.a).First();

                _air.b     = air.b;
                _air.c     = air.c;
                _air.Fecha = air.Fecha;

                bd.Entry(_air).State = System.Data.Entity.EntityState.Modified;
                rsp = bd.SaveChanges();
            }
            return(rsp);
        }