更新crud

This commit is contained in:
橙子
2023-02-05 22:59:22 +08:00
parent 95484877a3
commit 1d7c17e253
3 changed files with 38 additions and 6 deletions

View File

@@ -158,13 +158,12 @@ namespace Yi.Framework.Ddd.Services
{
throw new ArgumentNullException(nameof(id));
}
var entity = await MapToEntityAsync(input);
entity.Id = id;
await _repository.UpdateIgnoreNullAsync(entity);
var newEntity = await _repository.GetByIdAsync(id);
var entity = await _repository.GetByIdAsync(id);
await MapToEntityAsync(input, entity);
await _repository.UpdateAsync(entity);
return await MapToGetOutputDtoAsync(newEntity);
return await MapToGetOutputDtoAsync(entity);
}
}
}