public void refreshdata() { QuanLyBaoHiem.Models.QLBHContext dbContext = new QuanLyBaoHiem.Models.QLBHContext(); // Call the LoadAsync method to asynchronously get the data for the given DbSet from the database. dbContext.GoiHopDongs.LoadAsync().ContinueWith(loadTask => { // Bind data to control when loading complete goiHopDongsBindingSource.DataSource = dbContext.GoiHopDongs.Where(p => p.Status == true).ToList(); }, System.Threading.Tasks.TaskScheduler.FromCurrentSynchronizationContext()); }
public ucThongTinChinhSachBaoHiem() { InitializeComponent(); // This line of code is generated by Data Source Configuration Wizard // Instantiate a new DBContext QuanLyBaoHiem.Models.QLBHContext dbContext = new QuanLyBaoHiem.Models.QLBHContext(); // Call the LoadAsync method to asynchronously get the data for the given DbSet from the database. dbContext.GoiHopDongs.LoadAsync().ContinueWith(loadTask => { // Bind data to control when loading complete goiHopDongsBindingSource.DataSource = dbContext.GoiHopDongs.Where(p => p.Status == true).ToList(); }, System.Threading.Tasks.TaskScheduler.FromCurrentSynchronizationContext()); }