Exemple #1
0
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            var fmEquipmentTypeEditor = new WinEquipmentTypeEditor(context);

            fmEquipmentTypeEditor.ShowDialog();
            if (fmEquipmentTypeEditor.DialogResult == true)
            {
                context.EquipmentType.Load();
                equipmentTypeViewSource.Source = context.EquipmentType.ToList();
            }
        }
Exemple #2
0
        private void Edit_Click(object sender, RoutedEventArgs e)
        {
            var equipmentType = (EquipmentType)grEquipmentType.SelectedItem;
            var fmEditor      = new WinEquipmentTypeEditor(equipmentType);

            fmEditor.ShowDialog();
            if (fmEditor.DialogResult == true)
            {
                var entity = context.Room.Find(equipmentType.Id);
                if (entity == null)
                {
                    return;
                }
                entity.Name        = equipmentType.Name;
                entity.Description = equipmentType.Description;
                context.SaveChanges();
                context.Room.Load();
                equipmentTypeViewSource.Source = context.EquipmentType.ToList();
            }
        }