Initial commit

This commit is contained in:
2025-10-05 22:25:53 +03:00
parent de0f47c739
commit 9511f1928b
13 changed files with 562 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
using Microsoft.EntityFrameworkCore;
using WondersAPI.Models;
namespace WondersAPI.Data
{
public class AppDbContext : DbContext
{
public DbSet<Wonder> Wonders => Set<Wonder>();
public AppDbContext(DbContextOptions<AppDbContext> options) : base(options) { }
}
}
+22
View File
@@ -0,0 +1,22 @@
using System.Text.Json;
using WondersAPI.Models;
namespace WondersAPI.Data
{
public static class DataSeedingApplication
{
public static List<Wonder> SeedWonders(string filePath)
{
if (!File.Exists(filePath))
throw new FileNotFoundException($"Seed data file not found: {filePath}");
var json = File.ReadAllText(filePath);
var wonders = JsonSerializer.Deserialize<List<Wonder>>(json, new JsonSerializerOptions
{
PropertyNameCaseInsensitive = true
});
return wonders ?? new List<Wonder>();
}
}
}