public async Task <Response <IOcelotConfiguration> > Get()
        {
            var repoConfig = _repo.Get();

            if (repoConfig.IsError)
            {
                return(new ErrorResponse <IOcelotConfiguration>(repoConfig.Errors));
            }

            if (repoConfig.Data == null)
            {
                var creatorConfig = await _creator.Create();

                if (creatorConfig.IsError)
                {
                    return(new ErrorResponse <IOcelotConfiguration>(creatorConfig.Errors));
                }

                _repo.AddOrReplace(creatorConfig.Data);

                return(new OkResponse <IOcelotConfiguration>(creatorConfig.Data));
            }

            return(new OkResponse <IOcelotConfiguration>(repoConfig.Data));
        }
Пример #2
0
        public Response <IOcelotConfiguration> Get()
        {
            var repoConfig = _repo.Get();

            if (repoConfig.IsError)
            {
                return(new ErrorResponse <IOcelotConfiguration>(repoConfig.Errors));
            }

            return(new OkResponse <IOcelotConfiguration>(repoConfig.Data));
        }
Пример #3
0
        public async Task <Response <IOcelotConfiguration> > Get()
        {
            var repoConfig = await _repo.Get();

            if (repoConfig.IsError)
            {
                return(new ErrorResponse <IOcelotConfiguration>(repoConfig.Errors));
            }

            return(new OkResponse <IOcelotConfiguration>(repoConfig.Data));
        }