コード例 #1
0
        public async Task <ResultModel> SyncAsync(SyncRequestModel requestModel)
        {
            var model = _mapper.Map <SyncModel>(requestModel);
            List <AddConfigurationItemRequestModel> configurationItems = await _configCenterService.GetSyncConfigurationItemModelAsync(model);

            await _configCenterHubContext.Clients.All.SyncConfigurationItem(requestModel.SourceKey, requestModel.TargetKeys, configurationItems);

            return(ResultModel.Success("同步成功"));
        }
コード例 #2
0
        public IEnumerable <string> SyncProject([FromBody] SyncRequestModel syncRequest)
        {
            List <string> messages;

            try
            {
                syncService.ClearLog();
                if (!syncService.SyncProject(syncRequest.ProjectId))
                {
                    throw new HttpResponseException(HttpStatusCode.NotFound);
                }
                messages = syncService.Messages().ToList();
            }
            catch (Exception e)
            {
                messages = syncService.Messages().ToList();
                messages.Add(e.Message);
                messages.Add(e.StackTrace);
            }
            return(messages);
        }
コード例 #3
0
        public async Task <ResultModel> SyncAsync(SyncRequestModel requestModel)
        {
            var resultModel = await SendPutAsync <ResultModel>($"{_controllerUrl}Sync", requestModel);

            return(resultModel);
        }