diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 82f20e3cd..d54842b95 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -152,6 +152,7 @@ namespace IRaCIS.Core.Application.Contracts /// /// [HttpPost] + [UnitOfWork] [AllowAnonymous] [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] public async Task VerifySendCode(LoginDto userInfo, [FromServices] ITokenService _tokenService) diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs index 6d730007f..cf24c4f80 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs @@ -1056,7 +1056,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common var entity = item.Entity as TrialSiteSurvey; if (entity.TrialSite == null) { - entity.TrialSite = await _dbContext.TrialSite.Where(x => x.SiteId == entity.SiteId && x.TrialId == entity.TrialId).FirstOrDefaultAsync(); + entity.TrialSite = await _dbContext.TrialSite.IgnoreQueryFilters().Where(x => x.SiteId == entity.SiteId && x.TrialId == entity.TrialId).FirstOrDefaultAsync(); } if (entity.PreliminaryUser == null) @@ -1069,9 +1069,11 @@ namespace IRaCIS.Core.Infra.EFCore.Common entity.ReviewerUser = await _dbContext.User.Where(x => x.Id == entity.ReviewerUserId).FirstOrDefaultAsync(); } + var trialSiteId = entity.TrialSite?.Id; + await InsertInspection(item.Entity as TrialSiteSurvey, type, x => new InspectionConvertDTO() { - ObjectRelationParentId = entity.TrialSite.Id, + ObjectRelationParentId = trialSiteId, }, new {