예제 #1
0
        public async Task <ActivityLogging> GetOrCreateActivityAsync(IGuild guild)
        {
            var record = _coreContext.ActivityLogging.SingleOrDefault(x => x.GuildId == guild.Id);

            if (record == null)
            {
                _logging.Log($"Registering logging settings for {guild.Name} ({guild.Id})...",
                             LogSeverity.Info);
                record = new ActivityLogging {
                    GuildId = guild.Id
                };
                _coreContext.ActivityLogging.Add(record);
                await SaveRepositoryAsync().ConfigureAwait(false);
            }
            return(record);
        }
예제 #2
0
 public Task RemoveActivitySettingsAsync(ActivityLogging activitySettings)
 {
     _coreContext.ActivityLogging.Remove(activitySettings);
     return(SaveRepositoryAsync());
 }
예제 #3
0
        public async Task AddActivitySettingsAsync(ActivityLogging activitySettings)
        {
            await _coreContext.ActivityLogging.AddAsync(activitySettings).ConfigureAwait(false);

            await SaveRepositoryAsync().ConfigureAwait(false);
        }