Files
blazor-wms/Infrastructure/Database/Demo/VendorGroupSeeder.cs
T
2026-07-21 14:41:46 +07:00

28 lines
809 B
C#

using Indotalent.Data.Entities;
using Microsoft.EntityFrameworkCore;
namespace Indotalent.Infrastructure.Database.Demo;
public static class VendorGroupSeeder
{
public static async Task GenerateDataAsync(AppDbContext context)
{
if (await context.VendorGroup.AnyAsync()) return;
var vendorGroups = new List<VendorGroup>
{
new VendorGroup { Name = "Manufacture" },
new VendorGroup { Name = "Supplier" },
new VendorGroup { Name = "Service Provider" },
new VendorGroup { Name = "Distributor" },
new VendorGroup { Name = "Freelancer" }
};
foreach (var group in vendorGroups)
{
await context.VendorGroup.AddAsync(group);
}
await context.SaveChangesAsync();
}
}