using Siger.Middlelayer.Repository.Entities;
using Siger.Middlelayer.Repository.Repositories.Interface;

namespace Siger.Middlelayer.Repository.Repositories
{
    internal class SigerUserRoleRepository : ApiConfigRepositoryBase<siger_user_roles>, ISigerUserRoleRepository
    {
        private readonly ApiConfigDbContext _context;
        public SigerUserRoleRepository(ApiConfigDbContext context) : base(context)
        {
            _context = context;
        }

        public int AddUserRole(string title, int type)
        {
            var role = new siger_user_roles
            {
                name = title,
                description = title,
                type = 2
            };
            //1->平台角色 2->用户角 3->项目角色
            _context.siger_user_roles.Add(role);
            _context.SaveChanges();

            return role.id;
        }
    }
}
