fixed question transation issue
This commit is contained in:
parent
fc154274a0
commit
281a789deb
@ -349,6 +349,7 @@ namespace DamageAssesment.Api.Questions.Providers
|
|||||||
var dbquestiontranslation = mapper.Map<List<Models.QuestionsTranslation>, List<Db.QuestionsTranslation>>(Question.Questions);
|
var dbquestiontranslation = mapper.Map<List<Models.QuestionsTranslation>, List<Db.QuestionsTranslation>>(Question.Questions);
|
||||||
dbquestion.QuestionTypeId = questionDbContext.QuestionTypes.Where(a => a.TypeText == Question.TypeText).Select(a => a.Id).FirstOrDefault();
|
dbquestion.QuestionTypeId = questionDbContext.QuestionTypes.Where(a => a.TypeText == Question.TypeText).Select(a => a.Id).FirstOrDefault();
|
||||||
questionDbContext.Questions.Add(dbquestion);
|
questionDbContext.Questions.Add(dbquestion);
|
||||||
|
questionDbContext.SaveChanges();
|
||||||
dbquestiontranslation.ForEach(i => i.QuestionId = dbquestion.Id);
|
dbquestiontranslation.ForEach(i => i.QuestionId = dbquestion.Id);
|
||||||
questionDbContext.QuestionsTranslations.AddRange(dbquestiontranslation);
|
questionDbContext.QuestionsTranslations.AddRange(dbquestiontranslation);
|
||||||
questionDbContext.SaveChanges();
|
questionDbContext.SaveChanges();
|
||||||
|
Loading…
Reference in New Issue
Block a user