private void button4_Click(object sender, EventArgs e) { var _db = new DotNet3Context(); var studenti = _db.Studenti.Where(x => x.PunoIme == null); foreach (var student in studenti) { student.PunoIme = student.Ime + " " + student.Prezime; } _db.SaveChanges(); _db.Dispose(); }
private void button2_Click(object sender, EventArgs e) { var _db = new DotNet3Context(); _db.Predmeti.Add(new Predmet() { Naziv = textBox1.Text }); _db.SaveChanges(); _db.Dispose(); Close(); }
private void button2_Click(object sender, EventArgs e) { var _db = new DotNet3Context(); _db.StudentPredmet.Add(new StudentPredmet() { PredmetId = int.Parse(listBox2.SelectedValue.ToString()), StudentId = int.Parse(listBox1.SelectedValue.ToString()) }); _db.SaveChanges(); _db.Dispose(); Close(); }
private void button2_Click(object sender, EventArgs e) { var _db = new DotNet3Context(); _db.Studenti.Add(new Student() { Ime = textBox1.Text, Prezime = textBox2.Text, PunoIme = textBox1.Text + " " + textBox2.Text }); _db.SaveChanges(); _db.Dispose(); Close(); }