Example #1
0
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new GroupAddEditDialog();

            dialog.Title = "Добавить группу";
            if (dialog.ShowDialog() == true)
            {
                var group = new Group {
                    Name = dialog.GroupName
                };
                db.Groups.Add(group);
                UpdateGrid();
            }
        }
Example #2
0
        private void Edit_Click(object sender, RoutedEventArgs e)
        {
            if (Data.SelectedItem == null || Data.SelectedItem as Group == null)
            {
                return;
            }
            var group = Data.SelectedItem as Group;

            var dialog = new GroupAddEditDialog();

            dialog.Title     = "Редактировать группу";
            dialog.GroupName = group.Name;
            if (dialog.ShowDialog() == true)
            {
                group.Name = dialog.GroupName;
                UpdateGrid();
            }
        }