Exemple #1
0
        /// <summary>
        /// 删除配置项
        /// </summary>
        /// <param name="id"></param>
        /// <param name="autoSave"></param>
        /// <returns></returns>
        public async Task <bool> DeleteConfig(long id, bool autoSave = false)
        {
            var res = await _configRepository.DeleteAsync(id);

            if (autoSave)
            {
                UnitOfWork.Commit();
            }
            return(res > 0);
        }
        public async Task <IResultModel> Delete(int id)
        {
            var entity = await _repository.GetAsync(id);

            if (entity == null)
            {
                return(ResultModel.Failed("数据项不存在"));
            }

            var result = await _repository.DeleteAsync(id);

            return(ResultModel.Result(result));
        }
Exemple #3
0
        public async Task <IResultModel> Delete(int id)
        {
            var entity = await _repository.GetAsync(id);

            if (entity == null)
            {
                return(ResultModel.Failed("配置不存在"));
            }
            if (entity.Type != ConfigType.Custom)
            {
                return(ResultModel.Failed("非自定义配置不允许删除"));
            }

            var result = await _repository.DeleteAsync(id);

            return(ResultModel.Result(result));
        }
Exemple #4
0
        public async Task <IResultModel> Delete(int id)
        {
            var entity = await _repository.GetAsync(id);

            if (entity == null)
            {
                return(ResultModel.Failed("数据项不存在"));
            }

            var result = await _repository.DeleteAsync(id);

            if (result)
            {
                await _configContainer.Remove(entity.Key);
            }
            return(ResultModel.Result(result));
        }
Exemple #5
0
 public async Task <int> Delete(Config input)
 {
     return(await _configRepository.DeleteAsync(input));
 }