public async Task UpdateConfig(int key, string value) { if (key == typeof(RecurringRaidTemplate) .GetProperty(nameof(RecurringRaidTemplate.SoftResTemplateId)) .GetCustomAttribute <ConfigurationKeyAttribute>().Key) { var templateExists = await _softResRaidTemplateRepository.Contains(value); if (!templateExists) { await ReplyAsync("No such soft res template exists."); return; } } var config = await AddOrGetRaidTemplate(false); _templateConfigurationService.UpdateTemplate(config, key, value); await _recurringRaidTemplateRepository.SaveAllChangesAsync(); await ReplyAsync("Configuration updated successfully"); }
public async Task CreateTemplate(string id, int amount) { var newTemplate = _templateFactory.CreateNew(id, SoftResInstance.Naxxramas, SoftResFaction.Horde, amount); newTemplate.ServerId = Context.Guild.Id; var recurringTemplate = new RecurringRaidTemplate { ResetDayOfWeek = (int)DayOfWeek.Monday, ServerId = Context.Guild.Id, SoftResTemplate = newTemplate }; await _recurringRaidTemplateRepository.PostAsync(recurringTemplate); await _recurringRaidTemplateRepository.SaveAllChangesAsync(); }