private void Add()
        {
            Name = Trim(Name);

            MobileOperator mobileOperator = new MobileOperator{Name = Name};

            _mainViewModel.Context.MobileOperators.Add(mobileOperator);

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

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

            _mainViewModel.MobileOperatorsViewModel.Update();
            _mainViewModel.MobileOperatorsViewModel.AddDialogViewModel = null;
        }
예제 #2
0
 public MobileOperatorViewModel(MobileOperator mobileOperator)
 {
     ID = mobileOperator.ID;
     Name = mobileOperator.Name;
 }