Exemplo n.º 1
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            string Id = dtgvrule.SelectedCells[0].OwningRow.Cells["ID_RULE"].Value.ToString();

            rule         = db.RULEs.Find(Id);
            rule.ID_RULE = txtID_r.Text;
            rule.NAME    = txtName.Text;
            db.SaveChanges();
            Load_Data();
            Clear();
        }
Exemplo n.º 2
0
        private void btnDel_Click(object sender, EventArgs e)
        {
            string id = txtID_r.Text;

            rule = db.RULEs.First(x => x.ID_RULE == id);
            //foreach(var user in db.USERs.Where(d => d.ID_RULE == id))
            //{
            //    db.USERs.Remove(user);
            //}
            db.RULEs.Remove(rule);
            db.SaveChanges();
            Load_Data();
            Clear();
        }