initial commit
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
using Indotalent.Data.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Indotalent.Infrastructure.Database.Demo;
|
||||
|
||||
public static class CustomerCategorySeeder
|
||||
{
|
||||
public static async Task GenerateDataAsync(AppDbContext context)
|
||||
{
|
||||
if (await context.CustomerCategory.AnyAsync()) return;
|
||||
|
||||
var customerCategories = new List<CustomerCategory>
|
||||
{
|
||||
new CustomerCategory { Name = "Enterprise" },
|
||||
new CustomerCategory { Name = "Medium" },
|
||||
new CustomerCategory { Name = "Small" },
|
||||
new CustomerCategory { Name = "Startup" },
|
||||
new CustomerCategory { Name = "Micro" }
|
||||
};
|
||||
|
||||
foreach (var category in customerCategories)
|
||||
{
|
||||
await context.CustomerCategory.AddAsync(category);
|
||||
}
|
||||
|
||||
await context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user