LMS.service/LMS.DAO/MachineDAO/MachineBasicDao.cs

44 lines
1.2 KiB
C#
Raw Normal View History

2024-10-13 17:04:47 +08:00
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LMS.DAO.MachineDAO
{
public class MachineBasicDao(ApplicationDbContext context)
{
private readonly ApplicationDbContext _context = context;
/// <summary>
/// 检查机器码是否存在机器码不是对应的ID
/// </summary>
/// <param name="machineId"></param>
/// <returns></returns>
public async Task<bool> CheckMachineByMachineId(string? machineId)
{
if (string.IsNullOrWhiteSpace(machineId))
{
return false;
}
return await _context.Machine.AnyAsync(x => x.MachineId == machineId);
}
/// <summary>
/// 检查机器码是否存在机器码对应的ID
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public async Task<bool> CheckMachineById(string Id)
{
if (string.IsNullOrWhiteSpace(Id))
{
return false;
}
return await _context.Machine.AnyAsync(x => x.Id == Id);
}
}
}