public ActionResult DownloadClient() { var tvCategory = _configProvider.SabTvCategory; var tvCategorySelectList = new SelectList(new[] { tvCategory }); var downloadClientTypes = new List<KeyValuePair<int, string>>(); foreach (DownloadClientType downloadClientType in Enum.GetValues(typeof(DownloadClientType))) downloadClientTypes.Add(new KeyValuePair<int, string>((int)downloadClientType, downloadClientType.ToString())); var model = new DownloadClientSettingsModel { SabHost = _configProvider.SabHost, SabPort = _configProvider.SabPort, SabApiKey = _configProvider.SabApiKey, SabUsername = _configProvider.SabUsername, SabPassword = _configProvider.SabPassword, SabTvCategory = tvCategory, SabTvPriority = _configProvider.SabTvPriority, DownloadClientDropDirectory = _configProvider.SabDropDirectory, SabTvCategorySelectList = tvCategorySelectList, DownloadClient = (int)_configProvider.DownloadClient, BlackholeDirectory = _configProvider.BlackholeDirectory, DownloadClientSelectList = new SelectList(downloadClientTypes, "Key", "Value"), PneumaticDirectory = _configProvider.PneumaticDirectory }; return View(model); }
public JsonResult SaveDownloadClient(DownloadClientSettingsModel data) { if (ModelState.IsValid) { _configProvider.SabHost = data.SabHost; _configProvider.SabPort = data.SabPort; _configProvider.SabApiKey = data.SabApiKey; _configProvider.SabPassword = data.SabPassword; _configProvider.SabTvCategory = data.SabTvCategory; _configProvider.SabUsername = data.SabUsername; _configProvider.SabTvPriority = data.SabTvPriority; _configProvider.SabDropDirectory = data.DownloadClientDropDirectory; _configProvider.BlackholeDirectory = data.BlackholeDirectory; _configProvider.DownloadClient = (DownloadClientType)data.DownloadClient; _configProvider.PneumaticDirectory = data.PneumaticDirectory; return GetSuccessResult(); } return JsonNotificationResult.Oops("Invalid Data"); }
public ActionResult DownloadClient() { var tvCategory = _configProvider.SabTvCategory; var tvCategorySelectList = new SelectList(new[] { tvCategory }); var downloadClientTypes = new List<KeyValuePair<int, string>>(); foreach (DownloadClientType downloadClientType in Enum.GetValues(typeof(DownloadClientType))) downloadClientTypes.Add(new KeyValuePair<int, string>((int)downloadClientType, downloadClientType.ToString())); var model = new DownloadClientSettingsModel { SabHost = _configProvider.SabHost, SabPort = _configProvider.SabPort, SabApiKey = _configProvider.SabApiKey, SabUsername = _configProvider.SabUsername, SabPassword = _configProvider.SabPassword, SabTvCategory = tvCategory, SabBacklogTvPriority = _configProvider.SabBacklogTvPriority, SabRecentTvPriority = _configProvider.SabRecentTvPriority, DownloadClientDropDirectory = _configProvider.DownloadClientTvDirectory, SabTvCategorySelectList = tvCategorySelectList, DownloadClient = (int)_configProvider.DownloadClient, BlackholeDirectory = _configProvider.BlackholeDirectory, DownloadClientSelectList = new SelectList(downloadClientTypes, "Key", "Value"), PneumaticDirectory = _configProvider.PneumaticDirectory, UseSceneName = _configProvider.DownloadClientUseSceneName, NzbgetHost = _configProvider.NzbgetHost, NzbgetPort = _configProvider.NzbgetPort, NzbgetUsername = _configProvider.NzbgetUsername, NzbgetPassword = _configProvider.NzbgetPassword, NzbgetTvCategory = _configProvider.NzbgetTvCategory, NzbgetBacklogTvPriority = (Int32)_configProvider.NzbgetBacklogTvPriority, NzbgetRecentTvPriority = (Int32)_configProvider.NzbgetRecentTvPriority }; model.NzbgetPrioritySelectList = new SelectList(new List<dynamic> { new { Key = "Very Low", Value = "-100" }, new { Key = "Low", Value = "-50" }, new { Key = "Normal", Value = "0" }, new { Key = "High", Value = "-50" }, new { Key = "Very High", Value = "100" } }, "Value", "Key"); return View(model); }