public JobsController(IWebHostEnvironment environment, IConfiguration configuration, ILogger <CodeController> log, IScheduler factory) { //update _environment = environment ?? throw new ArgumentNullException(nameof(environment)); this.Configuration = configuration; this.Logger = log; _scheduler = factory; try { InitZmodDirectory.ScanModelsDirectory(); jobsResponse = SchedulerPayload.Get(); } catch (Exception ex) { Logger.LogCritical(ex, ex.StackTrace); } }
public IActionResult Get(bool loaded, bool refresh) { // if (refresh) { ModelPayload.Clear(); InitZmodDirectory.ScanModelsDirectory(); responseData = ModelPayload.Get(); } // DefaultContractResolver contractResolver = new DefaultContractResolver { NamingStrategy = new CamelCaseNamingStrategy() }; string jsonStr = JsonConvert.SerializeObject(responseData, new JsonSerializerSettings { ContractResolver = contractResolver, Formatting = Formatting.Indented }); var jsonObj = JsonConvert.DeserializeObject <List <ModelResponse> >(jsonStr); //loaded if (loaded) { List <ModelResponse> loadedModel = new List <ModelResponse>(); foreach (var record in jsonObj) { if (record.Loaded) { loadedModel.Add(record); } } return(Json(loadedModel)); } return(Json(jsonObj)); }