Update SeedData to be executed when MS launched, Enable other properties in SurveyResponse

This commit is contained in:
Reginald Cherenfant Jasmin
2023-09-04 21:31:41 -04:00
parent 81e14c387d
commit a1a9fd1dc5
35 changed files with 279 additions and 288 deletions

View File

@ -17,5 +17,6 @@ namespace DamageAssesment.Api.Questions.Interfaces
Task<(bool IsSuccess, Models.QuestionCategory QuestionCategory, string ErrorMessage)> PostQuestionCategoryAsync(Models.QuestionCategory QuestionCategory);
Task<(bool IsSuccess, Models.QuestionCategory QuestionCategory, string ErrorMessage)> UpdateQuestionCategoryAsync(Models.QuestionCategory QuestionCategory);
Task<(bool IsSuccess, Models.QuestionCategory QuestionCategory, string ErrorMessage)> DeleteQuestionCategoryAsync(int Id);
void SeedData();
}
}

View File

@ -37,6 +37,13 @@ if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
using (var serviceScope = app.Services.CreateScope())
{
var services = serviceScope.ServiceProvider;
var questionProvider = services.GetRequiredService<IQuestionsProvider>();
questionProvider.SeedData();
}
}
app.UseAuthorization();

View File

@ -24,7 +24,7 @@ namespace DamageAssesment.Api.Questions.Providers
SeedData();
}
private void SeedData()
public void SeedData()
{
if (!questionDbContext.QuestionsTranslations.Any())