working totalResults and currentPage on the API

Co-authored-by: Sindre Kjelsrud <kjelsrudsindre@gmail.com>
This commit is contained in:
haraldnilsen 2023-10-03 10:29:41 +02:00
parent d4b53e9912
commit 187c669495
4 changed files with 12 additions and 7 deletions

View file

@ -36,15 +36,15 @@ var services = builder.Services.BuildServiceProvider();
using (var scope = services.CreateScope())
{
var context = scope.ServiceProvider.GetRequiredService<MovieDbContext>();
context.Database.EnsureCreated();
if (context.Database.EnsureCreated())
{
context.Database.Migrate();
}
// Check if movies are already inserted to avoid duplicate insertion
if (!context.Movies.Any())
{
using (context)
{
context.Database.Migrate();
}
using (var reader = new StreamReader("public/DbMockData.csv"))
using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
{