public async Task Delete(long id) { var dict = await _dictDomainService.Get(id); var dictItems = await _dictRep.GetListAsync(new DictQuery { ParentId = id }); await _dictRep.DeleteAsync(dict); if (dictItems.Count < 1) { return; } await _dictRep.DeleteAsync(dictItems); }
public async Task <PopularResult> DeleteAsync(int id) { var result = new PopularResult(); await _dictRepository.DeleteAsync(id); return(result); }
public async Task <PopularResult <string> > UpdateAsync(DictTypeDto dto) { var result = new PopularResult <string>(); var dictType = ObjectMapper.Map <DictTypeDto, DictTypeEntity>(dto); await _dictRepository.DeleteAsync(x => x.DictTypeId == dto.Id); await _dictTypeRepository.UpdateAsync(dictType); result.Success("更新成功"); return(result); }
public async Task <IResultModel> Delete(int id) { var entity = await _repository.GetAsync(id); if (entity == null) { return(ResultModel.NotExists); } if (await _itemRepository.ExistsDict(entity.GroupCode, entity.Code)) { return(ResultModel.Failed("请先删除关联的数据项")); } var result = await _repository.DeleteAsync(id); if (result) { await _cacheHandler.RemoveAsync($"{CacheKeys.DictSelect}{entity.GroupCode.ToUpper()}_{entity.Code.ToUpper()}"); } return(ResultModel.Result(result)); }
public async Task <IResultModel> Delete(Guid id) { var result = await _repository.DeleteAsync(id); return(ResultModel.Result(result)); }