30 lines
791 B
C#
30 lines
791 B
C#
using LMS.Repository.Models.DB;
|
|
using Microsoft.AspNetCore.Identity;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace LMS.DAO.UserDAO
|
|
{
|
|
public class UserBasicDao(UserManager<User> userManager)
|
|
{
|
|
private readonly UserManager<User> _userManager = userManager;
|
|
/// <summary>
|
|
/// 检查用户是否存在,通过用户ID
|
|
/// </summary>
|
|
/// <param name="userId"></param>
|
|
/// <returns></returns>
|
|
public async Task<bool> CheckUserExistsByID(long? userId)
|
|
{
|
|
if (userId == null)
|
|
{
|
|
return false;
|
|
}
|
|
return await _userManager.FindByIdAsync(userId.ToString()) != null;
|
|
}
|
|
}
|
|
|
|
}
|