public async Task <DictionaryDetailDto> Create(CreateOrUpdateDictionaryDetailDto input) { var master = await _masterRepository.FirstOrDefaultAsync(_ => _.Id == input.Pid); if (master == null) { throw new BusinessException("未找到字典!"); } var exist = await _detailRepository.FirstOrDefaultAsync(_ => _.Label == input.Label); if (exist != null) { throw new BusinessException("名称:" + input.Label + "字典已存在"); } //var top = await _detailRepository.OrderByDescending(_ => _.Sort).FirstAsync(); //if (top != null) //{ //} var result = await _detailRepository.InsertAsync(new DataDictionaryDetail( GuidGenerator.Create(), input.Pid, input.Label, input.Value, 0)); //TODO:Sort排序 return(ObjectMapper.Map <DataDictionaryDetail, DictionaryDetailDto>(result)); }
public async Task <DictionaryDetailDto> Create(CreateOrUpdateDictionaryDetailDto input) { var master = await _masterRepository.FirstOrDefaultAsync(_ => _.Id == input.Pid); if (master == null) { throw new BusinessException("未找到字典!"); } var exist = await _detailRepository.FirstOrDefaultAsync(_ => _.Label == input.Label); if (exist != null) { throw new BusinessException("名称:" + input.Label + "字典已存在"); } var result = await _detailRepository.InsertAsync(new DataDictionaryDetail( GuidGenerator.Create(), CurrentTenant.Id, input.Pid, input.Label, input.Value, input.Sort)); return(ObjectMapper.Map <DataDictionaryDetail, DictionaryDetailDto>(result)); }
public async Task <DictionaryDetailDto> Update(Guid id, CreateOrUpdateDictionaryDetailDto input) { var detail = await _detailRepository.GetAsync(id); detail.Label = input.Label; detail.Value = input.Value; detail.Sort = input.Sort; return(ObjectMapper.Map <DataDictionaryDetail, DictionaryDetailDto>(detail)); }
public Task <DictionaryDetailDto> Update(Guid id, CreateOrUpdateDictionaryDetailDto input) { throw new NotImplementedException(); }
public Task <DictionaryDetailDto> Update(Guid id, CreateOrUpdateDictionaryDetailDto input) { return(_dictionaryDetailAppService.Update(id, input)); }
public Task <DictionaryDetailDto> Create(CreateOrUpdateDictionaryDetailDto input) { return(_dictionaryDetailAppService.Create(input)); }