public async Task AddConfigurationItemAsync(AddConfigurationItemModel model)
        {
            if (await _configurationItemRepository.ExistedAsync(m => m.Key.Equals(model.Key) && m.NamespaceID == model.NamespaceID && m.ProjectID == model.ProjectID))
            {
                throw new MateralConfigCenterException("Key已存在");
            }
            var configurationItem = model.CopyProperties <ConfigurationItem>();

            _protalServerUnitOfWork.RegisterAdd(configurationItem);
            await _protalServerUnitOfWork.CommitAsync();
        }
Esempio n. 2
0
        public async Task <ResultModel> AddConfigurationItem(AddConfigurationItemModel model)
        {
            try
            {
                await configurationItemService.AddConfigurationItemAsync(model);

                return(ResultModel.Success("添加成功"));
            }
            catch (AspectInvocationException ex)
            {
                return(ResultModel.Fail(ex.InnerException?.Message));
            }
            catch (MateralConfigCenterException ex)
            {
                return(ResultModel.Fail(ex.Message));
            }
        }