示例#1
0
        public async Task <ResultFlow <IEnumerable <ApiResourceRouteEntity> > > List(QueryParamValueObject <ApiResourceRouteEntity> model)
        {
            try
            {
                var sql    = @"SELECT *
                            FROM api_resource_route 
                           INNER JOIN api_resource ON api_resource_route.api_resource_id = api_resource.id
                           WHERE api_resource_route.status = 1
                           AND api_resource.status = 1";
                var result = await _connection.QueryAsync <ApiResourceRouteEntity, ApiResourceEntity, ApiResourceRouteEntity>(
                    sql,
                    (apiResourceRoute, apiResource) =>
                {
                    apiResourceRoute.ApiResource = apiResource;
                    return(apiResourceRoute);
                }
                    );

                return(ResultFlowFactory.Success <IEnumerable <ApiResourceRouteEntity> >(result));
            }
            catch
            {
                throw;
            }
        }
示例#2
0
        async Task SetApiResourceRoute()
        {
            try
            {
                var queryParamApiResourceRoute      = new QueryParamValueObject <ApiResourceRouteEntity>();
                var apiResourceRouteLogicResultFlow = await _apiResourceRouteLogic.List(queryParamApiResourceRoute);

                var jsonString = JsonConvert.SerializeObject(apiResourceRouteLogicResultFlow.Result);
                _redisConnection.StringSet(ApiResourceRoutesKey, jsonString);
                _logger.LogInformation(jsonString);
                return;
            }
            catch
            {
                throw;
            }
        }
示例#3
0
        public async Task <ResultFlow <IEnumerable <ApiResourceRouteEntity> > > List(QueryParamValueObject <ApiResourceRouteEntity> model)
        {
            try
            {
                var listResultFlow = await _apiResourceRouteRepository.List(model);

                if (listResultFlow.IsException())
                {
                    return(ResultFlowFactory.Exception <IEnumerable <ApiResourceRouteEntity> >(listResultFlow.Message));
                }
                return(ResultFlowFactory.Success <IEnumerable <ApiResourceRouteEntity> >(listResultFlow.Result));
            }
            catch
            {
                throw;
            }
        }