public async Task UpdateDataDicAsync(int id, DataDictionaryAddOrUpdateDto input) { if (await ExsitsAsync(input.Name, input.Key, id)) { throw new UserFriendlyException($"名称:{input.Name},键:{input.Key},已存在"); } var entity = await _dataDictionaryRepository.FindByIdAsync(id); ObjectMapper.Map(input, entity); await _dataDictionaryRepository.UpdateAsync(entity); }
public async Task AddDataDicAsync(DataDictionaryAddOrUpdateDto input) { if (await ExsitsAsync(input.Name, input.Key)) { throw new UserFriendlyException($"名称:{input.Name},键:{input.Key},已存在"); } var entity = ObjectMapper.Map <DataDictionaryAddOrUpdateDto, DataDictionary>(input); entity.TenantId = CurrentTenant.Id; await _dataDictionaryRepository.InsertAsync(entity); }
public async Task <ActionResult> UpdateDataDicAsync(int id, DataDictionaryAddOrUpdateDto input) { await _dataDictionaryService.UpdateDataDicAsync(id, input); return(Ok()); }