From 8ea8572947eed167537c6a0e12f198d6719c61f7 Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Thu, 7 May 2026 14:47:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=9F=E8=83=BD=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Reading/Segment/SegmentationService.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Reading/Segment/SegmentationService.cs b/IRaCIS.Core.Application/Service/Reading/Segment/SegmentationService.cs index cb8eed37b..04f691724 100644 --- a/IRaCIS.Core.Application/Service/Reading/Segment/SegmentationService.cs +++ b/IRaCIS.Core.Application/Service/Reading/Segment/SegmentationService.cs @@ -74,7 +74,12 @@ public class SegmentationService(IRepository _segmentationReposito [HttpPost] public async Task AddOrUpdateSegmentation(SegmentationAddOrEdit addOrEditSegmentation) { - + + if (addOrEditSegmentation.Id != null) + { + + await SaveSegmentationVersionAsync(new SaveSegmentationVersionAsyncInDto() { SegmentationId = addOrEditSegmentation.Id.Value }); + } var entity = await _segmentationRepository.InsertOrUpdateAsync(addOrEditSegmentation, true); return ResponseOutput.Ok(entity.Id.ToString()); } @@ -84,8 +89,8 @@ public class SegmentationService(IRepository _segmentationReposito /// /// /// - [HttpPost] - public async Task SaveSegmentationVersionAsync(SaveSegmentationVersionAsyncInDto inDto) + + private async Task SaveSegmentationVersionAsync(SaveSegmentationVersionAsyncInDto inDto) { var data = await _segmentationRepository.FirstOrDefaultNoTrackingAsync(x => x.Id == inDto.SegmentationId); var segmentList = await _segmentRepository.Where(x => x.SegmentationId == inDto.SegmentationId).OrderBy(x=>x.SegmentNumber).ProjectTo(_mapper.ConfigurationProvider).ToListAsync();