示例#1
0
        public async Task <ActionResult <SortJob> > EnqueueJob([FromBody] int[] values)
        {
            if (values == null)
            {
                return(BadRequest());
            }

            var pendingJob = new SortJob(
                id: Guid.NewGuid(),
                status: SortJobStatus.Pending,
                duration: null,
                input: values,
                output: null);
            var result = await repoService.EnqueueJobAsync("Jobs", pendingJob);

            if (result)
            {
                return(Ok());
            }
            return(StatusCode(500, "Unable to schedule the job, please try again after sometime"));
        }