Esempio n. 1
0
        public int Create(Dato p)
        {
            int inserterd = 0;

            using (var db = new AgendaTelelefonicaContext())
            {
                db.Add(p);
                inserterd = db.SaveChanges();
            }

            return(inserterd);
        }
Esempio n. 2
0
        public int DelelteDatobyId(int IdDatos)
        {
            int deleted = 0;

            using (var db = new AgendaTelelefonicaContext())
            {
                Dato customer = new Dato()
                {
                    IdDatos = IdDatos
                };
                db.Datos.Attach(customer);
                db.Datos.Remove(customer);
                deleted = db.SaveChanges();
            }

            return(deleted);
        }
Esempio n. 3
0
        public int DeleltePersonabyId(int IdNombre)
        {
            int deleted = 0;

            using (var db = new AgendaTelelefonicaContext())
            {
                Persona customer = new Persona()
                {
                    IdNombre = IdNombre
                };
                db.Personas.Attach(customer);
                db.Personas.Remove(customer);
                deleted = db.SaveChanges();
            }

            return(deleted);
        }