public MainWindow() { InitializeComponent(); var recentPoem = new LorryContext(); recentPoem.Recent.Load(); uxRecentPoem.DataContext = recentPoem.Recent.Local.ToObservableCollection(); }
public CoupletWindow() { InitializeComponent(); var coupletContext = new LorryContext(); coupletContext.Couplet.Load(); uxList.ItemsSource = coupletContext.Couplet.Local.ToObservableCollection(); }
public void uxGenerateCouplet_Click(object sender, RoutedEventArgs e) { var coupletContext = new LorryContext(); using (var dbContext = new LorryContext()) { List <Couplet> coupletList = coupletContext.Couplet.ToList(); Couplet randomCouplet = coupletList.RandomElement(); MessageBox.Show(randomCouplet.CoupletContent); } }