public void DeleteHousehold(int householdInternalId) { var personQuery = People.Where(a => a.InternalParentId == householdInternalId); if (personQuery.Any()) { foreach (var person in personQuery) { DeletePerson(person.InternalId); } } var incomeSourceQuery = IncomeSources.Where(a => a.InternalParentId == householdInternalId); if (incomeSourceQuery.Any()) { foreach (var incomeSource in incomeSourceQuery) { DeleteIncomeSource(incomeSource.InternalId); } } DeleteHouseholdCustomValues(householdInternalId); var householdQuery = Households.Where(a => a.InternalId == householdInternalId); if (householdQuery.Any()) { Households.RemoveRange(householdQuery); } }
public void DeleteIncomeSource(int incomeSourceInternalId) { var incomeSourceQuery = IncomeSources.Where(a => a.InternalId == incomeSourceInternalId); if (incomeSourceQuery.Any()) { IncomeSources.RemoveRange(incomeSourceQuery); } }