private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { EFDbcontext context = new EFDbcontext(); if (comboBox1.SelectedIndex.Equals(0)) { context.Films.Load(); dataGridView1.DataSource = context.Films.Local.ToBindingList(); } if (comboBox1.SelectedIndex.Equals(1)) { context.Actors.Load(); dataGridView1.DataSource = context.Actors.Local.ToBindingList(); } if (comboBox1.SelectedIndex.Equals(2)) { context.Genres.Load(); dataGridView1.DataSource = context.Genres.Local.ToBindingList(); } }
private void button2_Click(object sender, EventArgs e) { using (var context = new EFDbcontext()) { var actor = context.Actors.Find(2); using (var cotextDB = new EFDbcontext()) { cotextDB.Database.ExecuteSqlCommand("UPDATE Actors SET name = name + '_DB' WHERE actor_id ='2'"); } actor.name = actor.name + "_Memory"; string value = context.Entry(actor).Property(m => m.name).OriginalValue; textBox4.Text = string.Format("{0}", value); value = context.Entry(actor).Property(m => m.name).CurrentValue; textBox5.Text = string.Format("{0}", value); value = context.Entry(actor).GetDatabaseValues().GetValue <string>("name"); textBox6.Text = string.Format("{0}", value); } }
public T_UserServer(EFDbcontext _DbContext) : base(_DbContext) { base.DbContext = _DbContext; }
public ActorsController(EFDbcontext context) { _context = context; }
public T_SystemServer(EFDbcontext _DbContext) : base(_DbContext) { base.DbContext = _DbContext; }
public FilmsController(EFDbcontext context) { _context = context; }
public GenresController(EFDbcontext context) { _context = context; }