private void btnAddUpdate_Click(object sender, RoutedEventArgs e) { // add or update story block var context = new GBDBContext(); GBStoryBlock storyBlock = new GBStoryBlock() { Text = txtStoryBlock.Text }; context.GBStoryBlocks.Add(storyBlock); context.SaveChanges(); addMode = false; }
public MainWindow() { InitializeComponent(); this.Title = "GameBookEditor v1.0"; var context = new GBDBContext(); GBStoryBlock storyBlock = context.GBStoryBlocks.Where(b => b.Id.Equals(1)).FirstOrDefault(); //cboStoryBlocks.ItemsSource = context.GBStoryBlocks; People.Add(new Person { firstName = "fred", lastName = "smith" }); People.Add(new Person { firstName = "bill", lastName = "jones" }); cboStoryBlocks.ItemsSource = People; }