Exemplo n.º 1
0
        private static void SendNotifications(AppSettings settings)
        {
            var carsWithoutNotification = _dbHelper.GetCarsWithoutNotification();
            var urls = _dbHelper.GetUrls(carsWithoutNotification);

            var notifer = new TelegramNotifier(settings);

            notifer.SendNotificationsForCarsAsync(carsWithoutNotification, urls).Wait();

            var logRecords = carsWithoutNotification.Select(c =>
                                                            new NotificationLog {
                CarId         = c.Id,
                SentTimestamp = DateTime.UtcNow
            }).ToList();

            _dbHelper.InsertNotificationsLog(logRecords);
        }