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); }
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; }