forked from MDCPS/DamageAssessment_Backend
Update SeedData to be executed when MS launched, Enable other properties in SurveyResponse
This commit is contained in:
@ -7,6 +7,7 @@
|
||||
Task<(bool IsSuccess, Models.Survey Survey, string ErrorMessage)> PostSurveyAsync(Models.Survey Survey);
|
||||
Task<(bool IsSuccess, Models.Survey Survey, string ErrorMessage)> PutSurveyAsync(int Id,Models.Survey Survey);
|
||||
Task<(bool IsSuccess, Models.Survey Survey, string ErrorMessage)> DeleteSurveyAsync(int Id);
|
||||
void seedData();
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -53,6 +53,13 @@ if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
|
||||
using (var serviceScope = app.Services.CreateScope())
|
||||
{
|
||||
var services = serviceScope.ServiceProvider;
|
||||
var surveyProvider = services.GetRequiredService<ISurveyProvider>();
|
||||
surveyProvider.seedData();
|
||||
}
|
||||
}
|
||||
|
||||
app.UseAuthentication();
|
||||
|
@ -18,10 +18,10 @@ namespace DamageAssesment.Api.Surveys.Providers
|
||||
this.surveyDbContext = surveysDbContext;
|
||||
this.logger = logger;
|
||||
this.mapper = mapper;
|
||||
seedData();
|
||||
//seedData();
|
||||
}
|
||||
|
||||
private void seedData()
|
||||
public void seedData()
|
||||
{
|
||||
if (!surveyDbContext.Surveys.Any())
|
||||
{
|
||||
|
Reference in New Issue
Block a user