public ActionResult Index(ScheduledXmlEporterSettingsModel model) { string saveResult = ""; if (ModelState.IsValid) { _settings.ScheduleTime = model.ScheduleTime; //_settings.DefaultListId = model.DefaultListId; //_settings.ApiKey = model.ApiKey; //_settings.WebHookKey = model.WebHookKey; _settingService.SaveSetting(_settings); } // Update the task var task = FindScheduledTask(); if (task != null) { task.Enabled = model.AutoSync; task.Seconds = 20; //model.AutoSyncEachMinutes*60; _scheduleTaskService.UpdateTask(task); saveResult = _localizationService.GetResource("Plugin.Misc.ScheduledXmlEporter.AutoSyncRestart"); } model = PrepareModel(); //set result text //model.SaveResult = saveResult; return(View(VIEW_PATH, model)); }
private ScheduledXmlEporterSettingsModel PrepareModel() { var model = new ScheduledXmlEporterSettingsModel(); //Set the properties model.LastStartDate = _settings.LastStartDate.ToString(); model.ScheduleTime = _settings.ScheduleTime.ToString(); //model.ApiKey = _settings.ApiKey; //model.DefaultListId = _settings.DefaultListId; //model.WebHookKey = _settings.WebHookKey; ScheduleTask task = FindScheduledTask(); if (task != null) { //model.AutoSyncEachMinutes = task.Seconds / 60; model.AutoSync = task.Enabled; } ////Maps the list options //MapListOptions(model); return(model); }