public static async Task PublishStopsToEmbeddedSocial()

in code/PublishToEmbeddedSocial/Components/PublishStops.cs [80:131]


        public static async Task PublishStopsToEmbeddedSocial(IEnumerable<StopEntity> diffStops, string regionId, StorageManager publishStorage, StorageManager publishMetadataStorage, EmbeddedSocial embeddedSocial, string runId)
        {
            // create the publish metadata entity
            PublishMetadataEntity publishMetadataEntity = new PublishMetadataEntity()
            {
                RunId = runId,
                RegionId = regionId,
                AgencyId = string.Empty,
                RecordType = Storage.RecordType.Stop.ToString(),
                AddedCount = 0,
                UpdatedCount = 0,
                DeletedCount = 0,
                ResurrectedCount = 0
            };

            // iterate over each stop
            foreach (StopEntity diffStop in diffStops)
            {
                switch ((DataRowState)Enum.Parse(typeof(DataRowState), diffStop.RowState))
                {
                    case DataRowState.Create:
                        await embeddedSocial.CreateStop(diffStop);
                        await publishStorage.StopStore.Insert(diffStop);
                        publishMetadataEntity.AddedCount++;
                        break;

                    case DataRowState.Delete:
                        await embeddedSocial.DeleteStop(diffStop);
                        await publishStorage.StopStore.Update(diffStop);
                        publishMetadataEntity.DeletedCount++;
                        break;

                    case DataRowState.Update:
                        await embeddedSocial.UpdateStop(diffStop);
                        await publishStorage.StopStore.Update(diffStop);
                        publishMetadataEntity.UpdatedCount++;
                        break;

                    case DataRowState.Resurrect:
                        await embeddedSocial.ResurrectStop(diffStop);
                        await publishStorage.StopStore.Update(diffStop);
                        publishMetadataEntity.ResurrectedCount++;
                        break;

                    default:
                        throw new ArgumentOutOfRangeException("RowState");
                }
            }

            // publish the metadata entity
            await publishMetadataStorage.PublishMetadataStore.Insert(publishMetadataEntity);
        }