Пример #1
0
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            var fmRoom = new WinRoomEditor(context);

            fmRoom.ShowDialog();
            if (fmRoom.DialogResult == true)
            {
                context.Room.Load();
                roomViewSource.Source = context.Room.ToList();
            }
        }
Пример #2
0
        private void Edit_Click(object sender, RoutedEventArgs e)
        {
            var room   = (Room)grRooms.SelectedItem;
            var fmRoom = new WinRoomEditor(room);

            fmRoom.ShowDialog();
            if (fmRoom.DialogResult == true)
            {
                var entity = context.Room.Find(room.Id);
                if (entity == null)
                {
                    return;
                }
                entity.Floor       = room.Floor;
                entity.Name        = room.Name;
                entity.Description = room.Description;
                context.SaveChanges();
                context.Room.Load();
                roomViewSource.Source = context.Room.ToList();
            }
        }