public async Task <string> UpdateWordbookItem(UpdateWordbookItemInput input) { input.CheckDataAnnotations().CheckValidResult(); await _wordbookDomainService.UpdateWordbookItem(input); return("修改字典项成功"); }
public async Task UpdateWordbookItem(UpdateWordbookItemInput input) { var wordbookItem = await _wordbookItemRepository.SingleOrDefaultAsync(p => p.Id == input.Id); if (wordbookItem == null) { throw new BusinessException($"系统中不存在Id为{input.Id}的字典项"); } var wordbook = await _wordbookItemRepository.SingleOrDefaultAsync(p => p.Id == wordbookItem.WordbookId); if (wordbookItem == null) { throw new BusinessException($"系统中不存在Id为{wordbookItem.WordbookId}的字典类型"); } wordbookItem = input.MapTo(wordbookItem); await _wordbookItemRepository.UpdateAsync(wordbookItem); }