/// <summary> /// Called when [save new address]. /// </summary> private void OnSaveNewAddress() { if (IsSearchingMedicalPractice) { PossibleMedicalPractices.OfType <db.MedicalPracticeAddress>().Where(x => x.IsSelected).ToList().ForEach(add => { // Get associated addresses for MedicalPractice. var pmp = Model.PhysicianMedicalPractices.Where(pmpx => pmpx.MedicalPractice.Id == add.MedicalPractice.Id).FirstOrDefault(); if (pmp == null) { pmp = new db.PhysicianMedicalPractice() { Physician = Model, MedicalPractice = add.MedicalPractice, AssociatedPMPAddresses = new List <int>() }; Model.PhysicianMedicalPractices.Add(pmp); } // Add the associated address if needed. if (!pmp.AssociatedPMPAddresses.Contains(add.Id)) { pmp.AssociatedPMPAddresses.Add(add.Id); } }); } else { if (SelectedAddress == null) { return; } SelectedAddress.Validate(); if (SelectedAddress.HasErrors) { return; } Model.Addresses.Add(SelectedAddress); } ShowAddressPopup = Visibility.Collapsed; ProcessAddressForDisplay(); }
public PhysicianAuditLog(AuditType auditType, PhysicianMedicalPractice practice) : base(auditType, practice) { }