Exemplo n.º 1
0
        /// <summary>Cleanup method to remove single announcements that are in the past</summary>
        private async Task RemovePastJobsAsync()
        {
            var announcements = await dbContext.Announcements.Where(x => x.Type == AnnouncementType.Once && x.ExecutionTime < DateTime.Now).ToListAsync().ConfigureAwait(false);

            dbContext.RemoveRange(announcements);
            await dbContext.SaveChangesAsync().ConfigureAwait(false);
        }
Exemplo n.º 2
0
        /// <summary>Cleanup method to remove single reminders that are in the past</summary>
        private async Task RemovePastJobsAsync()
        {
            List <Reminder> reminders = await _dbContext.Reminders
                                        .AsQueryable()
                                        .Where(x => x.Type == ReminderType.Once && x.ExecutionTime < DateTime.Now)
                                        .ToListAsync()
            ;

            _dbContext.RemoveRange(reminders);
            await _dbContext.SaveChangesAsync();
        }