Пример #1
0
        public async Task <IHttpActionResult> ErmittleGecancelteJobs()
        {
            try
            {
                IHandleJobs repo   = new JobRepository(_username);
                var         result = await repo.GetCanceledJobs();

                foreach (var job in result.Data)
                {
                    job._links = new Link()
                    {
                        _actions = new List <Action>()
                        {
                            CreateActionLink <JobDetailController>(Names.LoescheJobIsCanceledFlag, c => c.LoescheJobIsCanceledFlag(job.UniqueId), Names.LoescheJobIsCanceledFlag)
                        }
                    };
                }

                var links = GetJobRootLinks();
                links._infos = new Dictionary <string, string> {
                    { "_dataCount", result.Data?.Count.ToString() }
                }
                .Concat(links._infos).ToDictionary(k => k.Key, v => v.Value);

                return(Ok(new JobResult <List <Job> >()
                {
                    SemasResult = result,
                    _links = links
                }));
            }
            catch (Exception e)
            {
                return(Content(HttpStatusCode.BadRequest, e.Message));
            }
        }