diff --git a/IRaCIS.Core.Application/Service/Common/DTO/DictionaryModel.cs b/IRaCIS.Core.Application/Service/Common/DTO/DictionaryModel.cs index 21eefce27..7b44a6441 100644 --- a/IRaCIS.Core.Application/Service/Common/DTO/DictionaryModel.cs +++ b/IRaCIS.Core.Application/Service/Common/DTO/DictionaryModel.cs @@ -97,6 +97,7 @@ namespace IRaCIS.Application.Contracts } public class GetCriterionDictionaryListOutDto { + public Guid Id { get; set; } public string Code { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; diff --git a/IRaCIS.Core.Application/Service/Common/DictionaryService.cs b/IRaCIS.Core.Application/Service/Common/DictionaryService.cs index 0fb296873..f1ae431fe 100644 --- a/IRaCIS.Core.Application/Service/Common/DictionaryService.cs +++ b/IRaCIS.Core.Application/Service/Common/DictionaryService.cs @@ -238,16 +238,21 @@ namespace IRaCIS.Application.Services /// public async Task> GetCriterionDictionaryList(GetCriterionDictionaryListInDto inDto) { - var codes = await _systemCriterionDictionaryCodeRepository.Where(x => x.SystemCriterionId == inDto.SystemCriterionId).Select(x => x.Code).ToListAsync(); + var criterionCodes= await _systemCriterionDictionaryCodeRepository.Where(x => x.SystemCriterionId == inDto.SystemCriterionId).ToListAsync(); + var codes = criterionCodes.Select(x=>x.Code).ToList(); var dictionaryList = await _dicRepository.Where(x => codes.Contains(x.Code)) .OrderBy(x => x.ShowOrder).Select(x => new GetCriterionDictionaryListOutDto() { Code = x.Code, Description = x.Description - }).ToListAsync(); + dictionaryList.ForEach(x => { + + x.Id = criterionCodes.Where(y => y.Code == x.Code).Select(x => x.Id).FirstOrDefault(); + }); + return dictionaryList; }