コード例 #1
0
ファイル: PanelConverterService.cs プロジェクト: mh2727/leaf
        async Task <PreflightResources> GetPreflightResourcesAsync(IEnumerable <IPanelDTO> panels)
        {
            var requested = panels.SelectMany(p => p.SubPanels)
                            .SelectMany(s => s.PanelItems)
                            .Select(i => i.Resource);
            var resources = new ResourceRefs(requested);

            return(await preflightReader.GetAsync(resources));
        }
コード例 #2
0
ファイル: QueryController.cs プロジェクト: mh2727/leaf
        public async Task <ActionResult <PreflightCheckDTO> > Preflight(
            [FromBody] ResourceRef resourceRef,
            [FromServices] IPreflightResourceReader preflightReader)
        {
            try
            {
                var refs = new ResourceRefs(new ResourceRef[] { resourceRef });
                var preflightResources = await preflightReader.GetAsync(refs);

                return(Ok(new PreflightCheckDTO(preflightResources)));
            }
            catch (LeafDbException lde)
            {
                return(StatusCode(lde.StatusCode));
            }
            catch (Exception e)
            {
                log.LogError("Could not preflight resource. Resource:{@Resource} Error:{Error}", resourceRef, e.ToString());
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }
        }