diff --git a/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs b/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs index d641ee572..b7d9402e5 100644 --- a/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs +++ b/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs @@ -34,7 +34,9 @@ namespace IRaCIS.Core.Application.Service [HttpPost] public async Task CopyOtherToThisItem(CopyOtherToThisItem item) { - + + var names = _frontAuditConfigRepository.Where(x => x.ParentId == item.AddItem).Select(x => x.ValueCN).ToList(); + var list = _frontAuditConfigRepository.Where(x => item.DataSource.Contains(x.ParentId)).ToList().GroupBy(x => new { x.ValueCN }, (key, lst) => new FrontAuditConfig { Sort = lst.Select(x => x.Sort).FirstOrDefault(), @@ -59,7 +61,7 @@ namespace IRaCIS.Core.Application.Service Id=Guid.NewGuid(), }).ToList(); - + list = list.Where(x => !names.Contains(x.ValueCN)).ToList(); await _repository.AddRangeAsync(list); await _repository.SaveChangesAsync();