public async Task <IActionResult> RemembotSettings(ulong guildId, [FromServices] IDiscordGuildService guildService) { var settings = await _reminderSettingsService.GetSettingsByGuild(guildId); var channels = await guildService.GetChannels(guildId); var textChannels = channels.Where(x => x.Type == 0).ToList(); if (settings is null) { settings = new RemembotSettings { Enabled = false, GuildId = guildId }; await _reminderSettingsService.SaveSettings(settings); } var reminders = await _recurringReminderService.Get(x => x.GuildId == guildId); settings.RecurringReminders = reminders; var viewModel = ReminderSettingsViewModel.FromData(settings, channels); return(View(viewModel)); }
public async Task <IActionResult> RemembotSettings(ulong guildId, ReminderSettingsViewModel reminderSettings) { await _reminderSettingsService.SaveSettings(new RemembotSettings { Enabled = reminderSettings.Enabled, GuildId = guildId }); return(RedirectToAction("Index")); }