コード例 #1
0
        // POST: api/Job
        public IHttpActionResult Post(JobDetail jobDetail)
        {
            jobDetail.RequestDateTime = DateTime.Now;

            jobDetail = jobQueueService.CreateJob(jobDetail, Url.Link("DefaultApi", new { controller = "Process", action = "DoSomething" }),
                                                  Url.Link("DefaultApi", new { controller = "Job", action = "UpdateJobResultStatus" }), Url.Link("DefaultApi", new { controller = "job", action = "UpdateJobProcessStatus" }));

            if (jobDetail.ProcessResult.HasError())
            {
                return(BadRequest(string.Join(";", jobDetail.ProcessResult.Errors)));
            }

            return(Ok <JobDetail>(jobDetail));
        }
コード例 #2
0
        public IHttpActionResult ProcessTask()
        {
            var jobDetail = new JobDetail()
            {
                RequestDateTime = DateTime.Now,
                ResultStatus    = ResultStatus.Requested,
                ProcessStatus   = ProcessStatus.Processing
            };

            jobDetail = jobQueueService.CreateJob(jobDetail, Url.Link("DefaultApi", new { controller = "Process", action = "DoSomething" }),
                                                  Url.Link("DefaultApi", new { controller = "Job", action = "UpdateJobResultStatus" }), Url.Link("DefaultApi", new { controller = "job", action = "UpdateJobProcessStatus" }));

            if (jobDetail.ProcessResult.HasError())
            {
                return(BadRequest(string.Join(";", jobDetail.ProcessResult.Errors)));
            }

            return(Ok(new { jobId = jobDetail.Id, message = "Process Task Created." }));
        }