Ejemplo n.º 1
0
        public Customer AddCustomer()
        {
            var vm = new WindowAddViewModel
            {
                Model         = new Customer(),
                OkCommand     = new RelayCommand(ExecuteOkCommand),
                CancelCommand = new RelayCommand(ExecuteCancelCommand)
            };

            mView = new WindowAdd
            {
                DataContext = vm
            };

            var result = mView.ShowDialog() ?? false;

            return(result ? vm.Model : null);
        }
Ejemplo n.º 2
0
        public Employee AddEmployee()
        {
            mView = new WindowAdd();

            WindowAddViewModel winAdM = new WindowAddViewModel();

            winAdM.Model         = new Employee();
            winAdM.OkCommand     = new RelayCommand(ExecuteOkCommand);
            winAdM.CancelCommand = new RelayCommand(ExecuteCancelCommand);

            mView.DataContext = winAdM;

            if (mView.ShowDialog() == true)
            {
                return(winAdM.Model);
            }
            else
            {
                return(null);
            }
        }
 public WindowAdd()
 {
     InitializeComponent();
     _vm         = new WindowAddViewModel();
     DataContext = _vm;
 }