Beispiel #1
0
        private async Task <Response> SaveScheduledJobs()
        {
            Analytics.TrackEventAsync(Category.Admin, Action.Update, "Update ScheduledJobs", Username, CookieHelper.GetAnalyticClientId(Cookies));
            var settings = this.Bind <ScheduledJobsSettings>();

            if (!string.IsNullOrEmpty(settings.RecentlyAddedCron))
            {
                // Validate CRON
                var isValid = CronExpression.IsValidExpression(settings.RecentlyAddedCron);

                if (!isValid)
                {
                    return(Response.AsJson(new JsonResponseModel
                    {
                        Result = false,
                        Message =
                            $"CRON {settings.RecentlyAddedCron} is not valid. Please ensure you are using a valid CRON."
                    }));
                }
            }
            var result = await ScheduledJobSettings.SaveSettingsAsync(settings);

            return(Response.AsJson(result
                ? new JsonResponseModel {
                Result = true
            }
                : new JsonResponseModel {
                Result = false, Message = "Could not save to Db Please check the logs"
            }));
        }
Beispiel #2
0
        private async Task <Response> SaveScheduledJobs()
        {
            Analytics.TrackEventAsync(Category.Admin, Action.Update, "Update ScheduledJobs", Username, CookieHelper.GetAnalyticClientId(Cookies));
            var settings = this.Bind <ScheduledJobsSettings>();

            var result = await ScheduledJobSettings.SaveSettingsAsync(settings);

            return(Response.AsJson(result
                ? new JsonResponseModel {
                Result = true
            }
                : new JsonResponseModel {
                Result = false, Message = "Could not save to Db Please check the logs"
            }));
        }