Пример #1
0
        public async Task <int> ClearOldDataAsync(DateTime before, SocketGuild guild)
        {
            var oldData = await GrillBotRepository.AuditLogs.GetAuditLogsBeforeDate(before, guild.Id).ToListAsync();

            foreach (var item in oldData.Where(o => o.Files.Count > 0))
            {
                GrillBotRepository.RemoveCollection(item.Files);
            }

            GrillBotRepository.RemoveCollection(oldData);
            await GrillBotRepository.CommitAsync();

            return(oldData.Count);
        }
Пример #2
0
        public async Task DeleteItemAsync(long id)
        {
            var item = await GrillBotRepository.AuditLogs.FindItemByIdAsync(id);

            if (item == null)
            {
                return;
            }

            if (item.Files.Count > 0)
            {
                GrillBotRepository.RemoveCollection(item.Files);
            }

            GrillBotRepository.Remove(item);
            await GrillBotRepository.CommitAsync();
        }