private void button1_Click(object sender, EventArgs e) { if (metroTextBox1.Text == string.Empty) { metroTextBox1.Focus(); label3.Text = "ادخل اسم البضاعه"; return; } if (metroTextBox2.Text == string.Empty) { metroTextBox2.Focus(); label3.Text = "ادخل سعر البضاعه"; return; } models.Good goo = new models.Good(); goo.Name = metroTextBox1.Text; goo.Price = decimal.Parse(metroTextBox2.Text); db.Goods.Add(goo); db.SaveChanges(); Close(); }
private void button1_Click(object sender, EventArgs e) { if (metroTextBox1.Text == string.Empty) { metroTextBox1.Focus(); label3.Text = "ادخل اسم البضاعه"; return; } if (metroTextBox2.Text == string.Empty) { metroTextBox2.Focus(); label3.Text = "ادخل سعر البضاعه"; return; } models.Good goo = new models.Good(); goo.Name = metroTextBox1.Text; goo.Price = decimal.Parse(metroTextBox2.Text); goo.id = Int32.Parse(metroTextBox3.Text); db.Entry(goo).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); Close(); }
public void masrofat(Masrofat ms, EntityState n) { db.Entry(ms).State = n; db.SaveChanges(); }