public EditPatientViewModel(PatientModel selPat) { _dataService = new DataService(); AddNoteViewModel = new AddNoteViewModel(); AddNoteViewModel.Save += AddNoteViewModelOnSave; AddNoteViewModel.Cancel += AddNoteViewModelOnCancel; EditPatientsCommand = new RelayCommand(ExecuteEditPatientsCommand, CanExecuteEditPatientsCommand); DeletePatientsCommand = new RelayCommand(ExecuteDeletePatientsCommand); CancelSavingCommand = new RelayCommand(ExecuteCancelSavingCommand); EditedPatient = new PatientModel { Gender = selPat.Gender, Race = selPat.Race, FirstName = selPat.FirstName, MiddleName = selPat.MiddleName, LastName = selPat.LastName, PhoneNumber = selPat.PhoneNumber, Ethnicity = selPat.Ethnicity, MartialStatus = selPat.MartialStatus, SocialSecurityNumber = selPat.SocialSecurityNumber, Address = selPat.Address, DateOfBirth = selPat.DateOfBirth, Diagnosis = selPat.Diagnosis, ChronicProblems = selPat.ChronicProblems, Notes = selPat.Notes, LocationId = selPat.LocationId }; Selected = selPat; _selectedFacility = new ApplicationDbContext().Patients.First(u => u.PatientId == Selected.PatientId).Facility.Name; }
private void AddNoteViewModelOnCancel(object sender, EventArgs eventArgs) { AddNoteViewModel.Reset(); }
//Add Note private void AddNoteViewModelOnSave(object sender, EventArgs eventArgs) { EditedPatient.Notes.Add(AddNoteViewModel.Note); AddNoteViewModel.Reset(); }