Пример #1
0
        public async Task <IActionResult> ReRoute(long routeId)
        {
            if (routeId == 0)
            {
                return(await Task.FromResult(View(new ReRouteDto())));
            }

            var reRouteDto = await _reRouteAppService.GetAsync(routeId);

            return(await Task.FromResult(View(reRouteDto)));
        }
        public async Task <Response <FileConfiguration> > Get()
        {
            var fileConfiguration = new FileConfiguration();

            var globalConfiguration = await _globalConfigurationAppService.GetAsync(new GlobalGetByAppIdInputDto { AppId = ApiGatewayOptions.AppId });

            fileConfiguration.GlobalConfiguration = _objectMapper.Map <GlobalConfigurationDto, FileGlobalConfiguration>(globalConfiguration);

            var reRouteConfiguration = await _reRouteAppService.GetAsync(new ReRouteGetByAppIdInputDto { AppId = ApiGatewayOptions.AppId });

            if (reRouteConfiguration != null && reRouteConfiguration.Items.Count > 0)
            {
                foreach (var reRouteConfig in reRouteConfiguration.Items)
                {
                    fileConfiguration.ReRoutes.Add(_objectMapper.Map <ReRouteDto, FileReRoute>(reRouteConfig));
                }
            }

            var dynamicReRouteConfiguration = await _dynamicReRouteAppService.GetAsync(new DynamicRouteGetByAppIdInputDto { AppId = ApiGatewayOptions.AppId });

            if (dynamicReRouteConfiguration != null && dynamicReRouteConfiguration.Items.Count > 0)
            {
                foreach (var dynamicRouteConfig in dynamicReRouteConfiguration.Items)
                {
                    fileConfiguration.DynamicReRoutes.Add(_objectMapper.Map <DynamicReRouteDto, FileDynamicReRoute>(dynamicRouteConfig));
                }
            }

            var aggregateReRouteConfiguration = await _aggregateReRouteAppService.GetAsync(new AggregateRouteGetByAppIdInputDto { AppId = ApiGatewayOptions.AppId });

            if (aggregateReRouteConfiguration != null && aggregateReRouteConfiguration.Items.Count > 0)
            {
                foreach (var aggregateRouteConfig in aggregateReRouteConfiguration.Items)
                {
                    fileConfiguration.Aggregates.Add(_objectMapper.Map <AggregateReRouteDto, FileAggregateReRoute>(aggregateRouteConfig));
                }
            }

            return(new OkResponse <FileConfiguration>(fileConfiguration));
        }