예제 #1
0
        private void DeleteSelectedPatient(PatientToBeDeleted patientToBeDeleted)
        {
            //AllPatients.Remove(patientToBeDeleted.PatientToBeDeletedProperty);
            _patientDataService.DeletePatient(patientToBeDeleted.PatientToBeDeletedProperty);
            _dialogService.ClosePatientsDetailDialog();
            var allPatients       = _patientDataService.GetAllPatients();
            var patientViewModels = allPatients.Select(x => PatientViewModel.FromModel(x));

            AllPatients.Clear();
            foreach (var patient in patientViewModels)
            {
                AllPatients.Add(patient);
            }
        }
예제 #2
0
        public MainWindowViewModel(IDialogService dialogService,
                                   IPatientDataService patientDataService)
        {
            _dialogService      = dialogService;
            _patientDataService = patientDataService;
            EditCommand         = new CustomCommand(Edit, CanEdit);
            AllPatients         = new ObservableCollection <PatientViewModel>();
            Messenger.Default.Register <PatientToBeDeleted>(this, DeleteSelectedPatient);
            var allPatients       = _patientDataService.GetAllPatients();
            var patientViewModels = allPatients.Select(x => PatientViewModel.FromModel(x));

            foreach (var patient in patientViewModels)
            {
                AllPatients.Add(patient);
            }
        }