Exemplo n.º 1
0
        /// <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, "字典名称已存在,请重新输入");
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        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);
        }