示例#1
0
        public static async Task PerformFullSync()
        {
            var baseUri = (AppSettings.GovDelivery.Server == GovDeliveryServer.Main)
                ? GovDeliveryApiService.MAIN_URI
                : GovDeliveryApiService.STAGING_URI;

            var service = new GovDeliveryApiService(
                baseUri,
                AppSettings.GovDelivery.AccountCode,
                AppSettings.GovDelivery.Username,
                AppSettings.GovDelivery.Password
                );

            var ctx = new GovDeliveryContext();

            Console.WriteLine("Beginning sync...");

            Console.WriteLine("Syncing Topics...");
            await BusinessTasks.SyncTopics(service, ctx);

            Console.WriteLine("Topic sync Successful");

            Console.WriteLine("Syncing Categories...");
            await BusinessTasks.SyncCategories(service, ctx);

            Console.WriteLine("Category sync successful...");

            Console.WriteLine(" Syncing Subscribers and Subscriptions...");
            await BusinessTasks.UpdateSubscribers(service, ctx);

            Console.WriteLine("");
        }
示例#2
0
        public static async Task <int> SyncTopics(IGovDeliveryApiService service, GovDeliveryContextFactory factory)
        {
            Console.WriteLine("Syncing Topics...");
            await BusinessTasks.SyncTopics(service, factory.CreateDbContext(), s => Console.WriteLine(s));

            Console.WriteLine("Topic sync Successful.");

            return(0);
        }