private void cBoxWork_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
 {
     if (e.Key == System.Windows.Input.Key.Delete)
     {// удаление по клавише delete
         if (cBoxWork.SelectedIndex > -1)
         {
             workService.DeleteWork((cBoxWork.SelectedItem as WorkViewModel).WorkId);
             works = workService.GetAll();
             cBoxWork.DataContext   = works;
             cBoxWork.SelectedIndex = 0;
         }
     }
     if (e.Key == System.Windows.Input.Key.Insert)
     {// обновление по клавише Insert
         if (cBoxWork.SelectedIndex > -1)
         {
             WorkViewModel workViewModel = cBoxWork.SelectedItem as WorkViewModel;
             EditWork      dialog        = new EditWork(workViewModel);
             var           result        = dialog.ShowDialog();
             if (result == true)
             {
                 workService.UpdateWork(workViewModel);
             }
             works = workService.GetAll();
             cBoxWork.DataContext = works;
         }
     }
 }
        private void ButtonAddWork_Click(object sender, RoutedEventArgs e)
        {
            WorkViewModel workViewModel = new WorkViewModel();

            workViewModel.Begin = new DateTime(1990, 01, 01);
            EditWork dialog = new EditWork(workViewModel);
            var      result = dialog.ShowDialog();

            if (result == true)
            {
                workService.CreateWork(workViewModel);
            }
            works = workService.GetAll();
            cBoxWork.DataContext = works;
        }