Files
blazor-swm/Infrastructure/Database/Demo/EmployeeCategorySeeder.cs
T
2026-07-21 14:35:37 +07:00

25 lines
699 B
C#

using Indotalent.Data.Entities;
using Microsoft.EntityFrameworkCore;
namespace Indotalent.Infrastructure.Database.Demo;
public static class EmployeeCategorySeeder
{
public static async Task GenerateDataAsync(AppDbContext context)
{
if (await context.EmployeeCategory.AnyAsync()) return;
var employeeCategories = new List<EmployeeCategory>
{
new EmployeeCategory { Name = "Front of House" },
new EmployeeCategory { Name = "Back of House" }
};
foreach (var category in employeeCategories)
{
await context.EmployeeCategory.AddAsync(category);
}
await context.SaveChangesAsync();
}
}