public int Create(Dato p) { int inserterd = 0; using (var db = new AgendaTelelefonicaContext()) { db.Add(p); inserterd = db.SaveChanges(); } return(inserterd); }
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); }
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); }