protected void Button2_Click(object sender, EventArgs e) { int id = Convert.ToInt32(TextBox1.Text); EmpData x = ede.EmpDatas.Find(id); if (x != null) { x.Name = TextBox2.Text; x.Salary = Convert.ToInt32(TextBox3.Text); x.Gender = TextBox4.Text; } ede.SaveChanges(); }
protected void Button1_Click1(object sender, EventArgs e) { var data = new EmpData { Id = Convert.ToInt32(TextBox1.Text), Name = TextBox2.Text, Salary = Convert.ToInt32(TextBox3.Text), Gender = TextBox4.Text }; ede.EmpDatas.Add(data); ede.SaveChanges(); }
protected void Button3_Click(object sender, EventArgs e) { int id = Convert.ToInt32(TextBox1.Text); EmpData x = ede.EmpDatas.Find(id); if (x != null) { ede.EmpDatas.Remove(x); } ede.SaveChanges(); }