Exemple #1
0
        /// <summary>
        /// 获取用户拥有的角色
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <returns></returns>
        public async Task <IList <Role> > GetAllAsync(int userId)
        {
            var roles = await _dbContext.Set <UserRole>().Where(a => a.User.Id == userId).Select(a => a.Role).ToListAsync();

            return(roles);
        }
 public async Task AddAsync(TEntity entity)
 {
     await _dbContext.Set <TEntity>().AddAsync(entity);
 }