From dbabc10e7c57d40b463204f72f3afa87df62b8d1 Mon Sep 17 00:00:00 2001 From: Vijay Uppu <913468@dadeschools.net> Date: Wed, 15 Nov 2023 09:06:20 -0500 Subject: [PATCH] fixed multiple question saving issue --- .../DamageAssesment.Api.Questions/Providers/QuestionsProvider.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/DamageAssesmentApi/DamageAssesment.Api.Questions/Providers/QuestionsProvider.cs b/DamageAssesmentApi/DamageAssesment.Api.Questions/Providers/QuestionsProvider.cs index 57e01fe..c07ab69 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Questions/Providers/QuestionsProvider.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.Questions/Providers/QuestionsProvider.cs @@ -254,6 +254,7 @@ namespace DamageAssesment.Api.Questions.Providers var dbquestiontranslation = mapper.Map, List>(Question.Questions); dbquestion.QuestionTypeId = questionDbContext.QuestionTypes.Where(a => a.TypeText == Question.TypeText).Select(a => a.Id).FirstOrDefault(); questionDbContext.Questions.Add(dbquestion); + questionDbContext.SaveChanges(); dbquestiontranslation.ForEach(i => i.QuestionId = dbquestion.Id); questionDbContext.QuestionsTranslations.AddRange(dbquestiontranslation); questionDbContext.SaveChanges();