重构项目结构,移除Assignment相关功能,优化Submission模块
Some checks failed
TechAct / explore-gitea-actions (push) Failing after 12s
Some checks failed
TechAct / explore-gitea-actions (push) Failing after 12s
This commit is contained in:
22
TechHelper.Server/Context/DbInitializer.cs
Normal file
22
TechHelper.Server/Context/DbInitializer.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using Entities.Contracts;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
||||
namespace TechHelper.Server.Context
|
||||
{
|
||||
public class DbInitializer
|
||||
{
|
||||
public static async Task SeedRoles(RoleManager<IdentityRole<Guid>> roleManager)
|
||||
{
|
||||
string[] defaultRoleName = { "Admin", "Teacher", "Student" };
|
||||
|
||||
foreach (var roleName in defaultRoleName)
|
||||
{
|
||||
if (!await roleManager.RoleExistsAsync(roleName))
|
||||
{
|
||||
await roleManager.CreateAsync(new IdentityRole<Guid>(roleName));
|
||||
Console.WriteLine($"Default role '{roleName}' created successfully.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user