29 lines
877 B
C#
29 lines
877 B
C#
using Indotalent.Data.Entities;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace Indotalent.Infrastructure.Database.Demo;
|
|
|
|
public static class CustomerGroupSeeder
|
|
{
|
|
public static async Task GenerateDataAsync(AppDbContext context)
|
|
{
|
|
if (await context.CustomerGroup.AnyAsync()) return;
|
|
|
|
var customerGroups = new List<CustomerGroup>
|
|
{
|
|
new CustomerGroup { Name = "Corporate" },
|
|
new CustomerGroup { Name = "Government" },
|
|
new CustomerGroup { Name = "Foundation" },
|
|
new CustomerGroup { Name = "Military" },
|
|
new CustomerGroup { Name = "Education" },
|
|
new CustomerGroup { Name = "Hospitality" }
|
|
};
|
|
|
|
foreach (var group in customerGroups)
|
|
{
|
|
await context.CustomerGroup.AddAsync(group);
|
|
}
|
|
|
|
await context.SaveChangesAsync();
|
|
}
|
|
} |