29 lines
868 B
C#
29 lines
868 B
C#
using Indotalent.Data.Entities;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace Indotalent.Infrastructure.Database.Demo;
|
|
|
|
public static class ProductGroupSeeder
|
|
{
|
|
public static async Task GenerateDataAsync(AppDbContext context)
|
|
{
|
|
if (await context.ProductGroup.AnyAsync()) return;
|
|
|
|
var productGroups = new List<ProductGroup>
|
|
{
|
|
new ProductGroup { Name = "Hardware" },
|
|
new ProductGroup { Name = "Networking" },
|
|
new ProductGroup { Name = "Storage" },
|
|
new ProductGroup { Name = "Device" },
|
|
new ProductGroup { Name = "Software" },
|
|
new ProductGroup { Name = "Service" }
|
|
};
|
|
|
|
foreach (var productGroup in productGroups)
|
|
{
|
|
await context.ProductGroup.AddAsync(productGroup);
|
|
}
|
|
|
|
await context.SaveChangesAsync();
|
|
}
|
|
} |