Files
blazor-saas-crm/Infrastructure/Database/Demo/BookingGroupSeeder.cs
T
2026-07-21 14:14:44 +07:00

26 lines
711 B
C#

using Indotalent.Data.Entities;
using Microsoft.EntityFrameworkCore;
namespace Indotalent.Infrastructure.Database.Demo;
public static class BookingGroupSeeder
{
public static async Task GenerateDataAsync(AppDbContext context)
{
if (await context.BookingGroup.AnyAsync()) return;
var bookingGroups = new List<BookingGroup>
{
new BookingGroup { Name = "Vehicle" },
new BookingGroup { Name = "Room" },
new BookingGroup { Name = "Electronic" }
};
foreach (var bookingGroup in bookingGroups)
{
await context.BookingGroup.AddAsync(bookingGroup);
}
await context.SaveChangesAsync();
}
}