private static void UpdateNames(StreetNameSyndicationItem syndicationItem, IReadOnlyCollection <GeografischeNaam> streetNames) { if (streetNames == null || !streetNames.Any()) { return; } foreach (var naam in streetNames) { switch (naam.Taal) { default: case Taal.NL: syndicationItem.NameDutch = naam.Spelling; break; case Taal.FR: syndicationItem.NameFrench = naam.Spelling; break; case Taal.DE: syndicationItem.NameGerman = naam.Spelling; break; case Taal.EN: syndicationItem.NameEnglish = naam.Spelling; break; } } }
private static void UpdateHomonymAdditions(StreetNameSyndicationItem syndicationItem, IReadOnlyCollection <GeografischeNaam> homonymAdditions) { if (homonymAdditions == null || !homonymAdditions.Any()) { return; } foreach (var naam in homonymAdditions) { switch (naam.Taal) { default: case Taal.NL: syndicationItem.HomonymAdditionDutch = naam.Spelling; break; case Taal.FR: syndicationItem.HomonymAdditionFrench = naam.Spelling; break; case Taal.DE: syndicationItem.HomonymAdditionGerman = naam.Spelling; break; case Taal.EN: syndicationItem.HomonymAdditionEnglish = naam.Spelling; break; } } }
private static async Task AddSyndicationItemEntry(AtomEntry <SyndicationItem <StreetName> > entry, SyndicationContext context, CancellationToken ct) { var latestItem = new StreetNameSyndicationItem { StreetNameId = entry.Content.Object.StreetNameId, NisCode = entry.Content.Object.NisCode, Version = entry.Content.Object.Identificator?.Versie, Position = long.Parse(entry.FeedEntry.Id), PersistentLocalId = entry.Content.Object.Identificator?.ObjectId, }; UpdateNames(latestItem, entry.Content.Object.StreetNames); UpdateHomonymAdditions(latestItem, entry.Content.Object.HomonymAdditions); await context .StreetNameSyndicationItems .AddAsync(latestItem, ct); }