public Guid?New([FromBody] JobPostParameters postParams) { //this DB call should be in a BL eventually. ScriptVersion ver = _dbContext.ScriptVersion.Where(v => v.ScriptVersionId == postParams.ScriptVersionID).FirstOrDefault(); if (ver != null) { return(_jobManager.QueueJob(ver, postParams.Parameters, _ephItUser.Register().UserId, postParams.ScheduleID, postParams.AutomationID)); } return(null); }
protected override void ProcessRecord() { string url = automationHelper.GetUrl() + "/api/Job/"; JobPostParameters jobPostParameters = new JobPostParameters(); jobPostParameters.AutomationID = AutomationID; jobPostParameters.ScheduleID = ScheduleID; jobPostParameters.ScriptVersionID = ScriptVersionId; jobPostParameters.Parameters = JsonConvert.SerializeObject(Parameters); string response = automationHelper.PostWebCall(url, jobPostParameters); if (!string.IsNullOrEmpty(response)) { var guidResponse = JsonConvert.DeserializeObject <Guid>(response); WriteObject(guidResponse); } base.ProcessRecord(); }