From c254897f3c26df407b410987c0eabcb2bafbe61b Mon Sep 17 00:00:00 2001 From: Christian de Jonge Date: Mon, 23 Oct 2023 08:37:25 +0200 Subject: [PATCH] Make sure db does not create new robot on mission run create --- backend/api/Services/MissionRunService.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backend/api/Services/MissionRunService.cs b/backend/api/Services/MissionRunService.cs index 090dcb269..678c14c69 100644 --- a/backend/api/Services/MissionRunService.cs +++ b/backend/api/Services/MissionRunService.cs @@ -88,6 +88,8 @@ private IQueryable GetMissionRunsWithSubModels() public async Task Create(MissionRun missionRun) { + // Making sure database does not try to create new robot + _context.Entry(missionRun.Robot).State = EntityState.Unchanged; await _context.MissionRuns.AddAsync(missionRun); await _context.SaveChangesAsync();