Example #1
0
        public async Task <ShardingConfigGetResponse> ShardingConfigGet(ShardingConfigGetRequest request)
        {
            ShardingConfigGetResponse response = new ShardingConfigGetResponse();

            try
            {
                if (request.Id > 0)
                {
                    RShardingConfig shardingConfig = await _shardingService.Get(request.Id);

                    if (shardingConfig == null)
                    {
                        response.SetFail(BaseResponse.ErrorCodeEnum.ShardingConfigNotFound);
                        return(response);
                    }
                    response = new ShardingConfigGetResponse(shardingConfig.ToModel());
                }
                response.SetSucess();
            }
            catch (Exception e)
            {
                response.SetFail(e);
                _logger.LogError(e, e.Message, request);
            }
            return(response);
        }
Example #2
0
        public async Task <IActionResult> Get([FromBody] ShardingConfigGetRequest request)
        {
            try
            {
                var response = await _shardingAppService.ShardingConfigGet(request);

                return(Json(response));
            }
            catch (Exception e)
            {
                _logger.LogError(e, Common.Common.GetMethodName(), request);
                throw;
            }
        }