diff --git a/AsbCloudInfrastructure/Services/WellService.cs b/AsbCloudInfrastructure/Services/WellService.cs index 1a907725..105cb5b3 100644 --- a/AsbCloudInfrastructure/Services/WellService.cs +++ b/AsbCloudInfrastructure/Services/WellService.cs @@ -33,7 +33,8 @@ namespace AsbCloudInfrastructure.Services .Include(w => w.Telemetry) .Include(w => w.WellType) .Include(w => w.RelationCompaniesWells) - .ThenInclude(r => r.Company); + .ThenInclude(r => r.Company) + .AsNoTracking(); public WellService(IAsbCloudDbContext db, IMemoryCache memoryCache, ITelemetryService telemetryService, ITimezoneService timezoneService, WellInfoService wellInfoService) : base(db, memoryCache, MakeQueryWell) diff --git a/AsbCloudWebApi/Controllers/WellController.cs b/AsbCloudWebApi/Controllers/WellController.cs index 3ed37d65..51e215ca 100644 --- a/AsbCloudWebApi/Controllers/WellController.cs +++ b/AsbCloudWebApi/Controllers/WellController.cs @@ -135,8 +135,8 @@ namespace AsbCloudWebApi.Controllers idWell, token).ConfigureAwait(false)) return Forbid(); - var dto = wellService.GetOrDefault(idWell)!; - dto.IdState = idState; + var dto = await wellService.GetOrDefaultAsync(idWell, token); + dto!.IdState = idState; var result = await wellService.UpdateAsync(dto, token) .ConfigureAwait(false);