Example #1
0
        void Edit_Data()
        {
            string id = dtgvgroup.SelectedCells[0].OwningRow.Cells["ID_GROUP"].Value.ToString();

            gr          = db.GROUP_DEVICE.Find(id);
            gr.ID_GROUP = txtID.Text;
            gr.NAME     = txtNAME.Text;
            db.SaveChanges();
            Load1();
        }
Example #2
0
        private void btnDel_Click(object sender, EventArgs e)
        {
            string id = txtID.Text;

            gr = db.GROUP_DEVICE.First(p => p.ID_GROUP == id);
            //foreach(var d in db.DEVICEs.Where(f => f.ID_GROUP == id))
            //{
            //    db.DEVICEs.Remove(d);
            //}
            db.GROUP_DEVICE.Remove(gr);
            db.SaveChanges();
            Load1();
            Clear();
        }