Пример #1
0
        private void AddRepairer()
        {
            FirstName = Trim(FirstName);
            LastName = Trim(LastName);

            Contragent contragent = new Contragent { FirstName = FirstName, LastName = LastName };
            Repairer repairer = new Repairer {Contragent = contragent};

            try
            {
                _mainViewModel.Context.Repairers.Add(repairer);
                _mainViewModel.Context.SaveChanges();
            }
            catch (Exception e)
            {
                MessageBox.Show(("Не удалось добавить нового мастера"), "Error",
                        MessageBoxButton.OK, MessageBoxImage.Error);

                Logging.WriteToLog("Failed add new repairer" + e.Message);
            }

            _mainViewModel.RepairersViewModel.Update();

            _mainViewModel.RepairersViewModel.AddRepairerDialogViewModel = null;
        }
Пример #2
0
 public RepairerViewModel(Repairer repairer)
     : base(repairer.Contragent)
 {
 }