59 lines
1.5 KiB
C#
59 lines
1.5 KiB
C#
using Cowain.Base.DBContext;
|
|
using Cowain.Base.Helpers;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
namespace Cowain.Base.Models.Admins;
|
|
|
|
|
|
[Table("user_role_menu")]
|
|
public class UserRoleMenuDto : BaseModel
|
|
{
|
|
[Key]
|
|
public int Id { get; set; }
|
|
public int RoleId { get; set; }
|
|
public string? MenuKey { get; set; }
|
|
public string? MenuActions { get; set; }
|
|
}
|
|
|
|
|
|
|
|
public class UserRoleMenuSeed : IDataSeeding
|
|
{
|
|
public void DataSeeding(ModelBuilder modelBuilder)
|
|
{
|
|
modelBuilder.Entity<UserRoleMenuDto>().HasData(
|
|
new UserRoleMenuDto
|
|
{
|
|
Id = 1,
|
|
RoleId = 1,
|
|
MenuKey = "Home",
|
|
MenuActions = "[]"
|
|
},
|
|
new UserRoleMenuDto
|
|
{
|
|
Id = 2,
|
|
RoleId = 1,
|
|
MenuKey = "UserRoleSetting",
|
|
MenuActions = "[ \"add\", \"edit\", \"delete\"]"
|
|
},
|
|
new UserRoleMenuDto
|
|
{
|
|
Id = 3,
|
|
RoleId = 1,
|
|
MenuKey = "RoleMenuSetting",
|
|
MenuActions = "[ \"edit\", \"delete\"]"
|
|
},
|
|
new UserRoleMenuDto
|
|
{
|
|
Id = 4,
|
|
RoleId = 1,
|
|
MenuKey = "UserManagement",
|
|
MenuActions = "[ \"add\", \"edit\", \"delete\"]"
|
|
}
|
|
);
|
|
|
|
}
|
|
}
|