/// <summary> /// 检查是否存在相同名字or相同编码 /// </summary> /// <returns></returns> public async Task CheckNameCode(string name, string code) { var sameItems = await _dictRep.GetListAsync(new DictQuery { DictName = name }); H_AssertEx.That(sameItems.Count > 0, "字典名称已存在,请重新输入"); sameItems = await _dictRep.GetListAsync(new DictQuery { DictCode = code }); H_AssertEx.That(sameItems.Count > 0, "字典名称已存在,请重新输入"); }
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 <List <DictDto> > > GetAllAsync() { var result = new PopularResult <List <DictDto> >(); var dicts = await _dictRepository.GetListAsync(); if (dicts == null) { result.Failed("数据不存在"); return(result); } var dtos = ObjectMapper.Map <List <DictEntity>, List <DictDto> >(dicts); result.Success(dtos); return(result); }