25 lines
869 B
C#
25 lines
869 B
C#
using Microsoft.EntityFrameworkCore;
|
|
|
|
public static class GatewayRegistrySeeder
|
|
{
|
|
public static readonly Guid DemoSiteId =
|
|
Guid.Parse("11111111-1111-1111-1111-111111111111");
|
|
public static readonly Guid DemoGatewayId =
|
|
Guid.Parse("22222222-2222-2222-2222-222222222222");
|
|
|
|
public static async Task SeedAsync(AppDbContext db)
|
|
{
|
|
if (await db.ClinicalSites.AnyAsync()) return;
|
|
|
|
var site = new ClinicalSite("SITE-DEMO", "Demo General Hospital", "123 Main St");
|
|
db.Entry(site).Property(nameof(ClinicalSite.Id)).CurrentValue = DemoSiteId;
|
|
db.ClinicalSites.Add(site);
|
|
|
|
var gateway = new WardGateway(DemoSiteId, "GW-ICU-3B", "ICU");
|
|
db.Entry(gateway).Property(nameof(WardGateway.Id)).CurrentValue = DemoGatewayId;
|
|
db.WardGateways.Add(gateway);
|
|
|
|
await db.SaveChangesAsync();
|
|
}
|
|
}
|