@@ -1346,12 +1346,15 @@ namespace IRaCIS.Core.Application
|
||||
public async Task<IResponseOutput> AddOrUpdateTrialBodyPart(AddOrUpdateTrialBodyPartCommand incommand)
|
||||
{
|
||||
|
||||
var codeList = await _repository.Where<TrialBodyPart>(t => t.TrialId == incommand.TrialId).Select(t => t.Code).ToListAsync();
|
||||
var codeList = await _repository.Where<TrialBodyPart>(t => t.TrialId == incommand.TrialId)
|
||||
.WhereIf(incommand.Id!=null,t=>t.Id!=incommand.Id)
|
||||
.Select(t => t.Code).ToListAsync();
|
||||
|
||||
|
||||
var newString = incommand.Code;
|
||||
// 检查字符串是否在集合中存在,如果存在,则在后面加上一个数字
|
||||
int count = 1;
|
||||
|
||||
while (codeList.Contains(newString))
|
||||
{
|
||||
newString = $"{newString}{count}";
|
||||
|
||||
Reference in New Issue
Block a user