private void buttonSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                ShowPlanned showplanned = new ShowPlanned();

                showplanned.Name   = textBoxShowname.Text;
                showplanned.Season = Convert.ToInt16(textBoxSeason.Text);

                _repository.AddShowPlanned(showplanned);

                listBoxList.Items.Clear();

                foreach (ShowPlanned s in context.ShowsPlanned)
                {
                    listBoxList.Items.Add(string.Format("* {0}, season {1}", s.Name, s.Season));
                }
            }
            catch
            {
                MessageBox.Show("Check your data again", "Something gone wrong", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Example #2
0
 public void AddShowPlanned(ShowPlanned showplanned)
 {
     context.ShowsPlanned.Add(showplanned);
     context.SaveChanges();
 }