public void DeletePerson(int personInternalId) { var serviceInstanceQuery = ServiceInstances.Where(a => a.InternalParentId == personInternalId); if (serviceInstanceQuery.Any()) { foreach (var serviceInstance in serviceInstanceQuery) { DeleteServiceInstance(serviceInstance.InternalId); } } var personFollowUpQuery = PersonFollowUps.Where(a => a.InternalParentId == personInternalId); if (personFollowUpQuery.Any()) { foreach (var personFollowUp in personFollowUpQuery) { DeletePersonFollowUp(personFollowUp.InternalId); } } DeletePersonCustomValues(personInternalId); var personQuery = People.Where(a => a.InternalId == personInternalId); if (personQuery.Any()) { People.RemoveRange(personQuery); } }
public void DeletePersonFollowUp(int personFollowUpInternalId) { DeletePersonFollowUpCustomValues(personFollowUpInternalId); var personFollowUpQuery = PersonFollowUps.Where(a => a.InternalId == personFollowUpInternalId); if (personFollowUpQuery.Any()) { PersonFollowUps.RemoveRange(personFollowUpQuery); } }