public void DeleteEmpresa(int RUT) { using (CEREBROEntities1 db = new CEREBROEntities1()) { db.Empresas.Remove(db.Empresas.Find(RUT)); db.SaveChanges(); } }
public void UpdateEmpresa(Empresa emp) { using (CEREBROEntities1 db = new CEREBROEntities1()) { Empresas e = new Empresas(); e = db.Empresas.Find(emp.RUT); e.setModel(emp); db.Entry(e).State = EntityState.Modified; db.SaveChanges(); } }
public void AddEmpresa(Empresa emp) { using (CEREBROEntities1 db = new CEREBROEntities1()) { if (emp != null) { Empresas nuevo = new Empresas(); nuevo.setModel(emp); db.Empresas.Add(nuevo); db.SaveChanges(); } } }