Example #1
0
        private void AddDeparture_Click(object sender, RoutedEventArgs e)
        {
            var addDepartureDialog = new AddDeparture();

            if (addDepartureDialog.ShowDialog() == true)
            {
                using (var context = new TimeTable())
                {
                    context.Add(addDepartureDialog.NewDeparture);
                    context.SaveChanges();
                }

                RefreshTables();
            }
        }
Example #2
0
        private void AddCity_Click(object sender, RoutedEventArgs e)
        {
            var addCityDialog = new AddCity();

            if (addCityDialog.ShowDialog() == true)
            {
                using (var context = new TimeTable())
                {
                    context.Add(new City {
                        Id = null, Name = addCityDialog.NewName
                    });
                    context.SaveChanges();
                }

                RefreshTables();
            }
        }