예제 #1
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         County county = ctx.Counties.Find(clickedID);
         ctx.Counties.Remove(county);
         ctx.SaveChanges();
         txtCounty.Text = string.Empty;
         List();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #2
0
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     try
     {
         County county = ctx.Counties.Find(clickedID);
         county.CountyName = txtCounty.Text;
         county.CityID     = (int)cmbCity.SelectedValue;
         ctx.SaveChanges();
         List();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }