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

@ -9,5 +9,6 @@
Task<(bool IsSuccess, Models.Answer Answer, string ErrorMessage)> PostAnswerAsync(Models.Answer Answer);
Task<(bool IsSuccess, Models.Answer Answer, string ErrorMessage)> UpdateAnswerAsync(Models.Answer Answer);
Task<(bool IsSuccess, Models.Answer Answer, string ErrorMessage)> DeleteAnswerAsync(int Id);
void SeedData();
}
}

View File

@ -25,8 +25,10 @@ builder.Services.AddDbContext<AnswerDbContext>(option =>
{
option.UseInMemoryDatabase("Answers");
});
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{

View File

@ -18,12 +18,11 @@ namespace DamageAssesment.Api.Answers.Providers
this.answerDbContext = answerDbContext;
this.logger = logger;
this.mapper = mapper;
SeedData();
//SeedData();
}
public async Task<(bool IsSuccess, IEnumerable<Models.Answer> Answers, string ErrorMessage)> GetAnswersAsync()
{
try
{
logger?.LogInformation("Query Question");
@ -188,7 +187,7 @@ namespace DamageAssesment.Api.Answers.Providers
return answerDbContext.Answers.AsNoTracking().Count(e => e.Id == id) > 0;
}
private void SeedData()
public void SeedData()
{
if (!answerDbContext.Answers.Any())
{