Example #1
0
        private void ShowSnackMachine(SnackMachineDto snackMachineDto)
        {
            logic.SnackMachine.SnackMachine snackMachine = _snackMachineRepository.GetById(snackMachineDto.Id);

            if (snackMachine == null)
            {
                MessageBox.Show("Snack machine was not found", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            _dialogService.ShowDialog(new SnackMachineViewModel(snackMachine));
            RefreshAll();
        }
Example #2
0
        private void UnloadCash(SnackMachineDto snackMachineDto)
        {
            logic.SnackMachine.SnackMachine snackMachine = _snackMachineRepository.GetById(snackMachineDto.Id);

            if (snackMachine == null)
            {
                return;
            }

            HeadOffice.UnloadCashFromSnackMachine(snackMachine);
            _snackMachineRepository.Save(snackMachine);
            _headOfficeRepository.Save(HeadOffice);

            RefreshAll();
        }
        public MainViewModel()
        {
            using (ISession session = SessionFactory.OpenSession())
            {
                logic.SnackMachine.SnackMachine snackMachine = session.Get <logic.SnackMachine.SnackMachine>(1L);
                var viewModel = new SnackMachineViewModel(snackMachine);
                _dialogService.ShowDialog(viewModel);
            }

            //logic.SnackMachine.SnackMachine snackMachine = new SnackMachineRepository().GetById(1);
            //var viewModel = new SnackMachineViewModel(snackMachine);

            //var atm = new AtmRepository().GetById(1);
            //var viewModel = new AtmViewModel(atm);
            //_dialogService.ShowDialog(viewModel);
        }