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; /// /// 检查机器码是否存在(机器码,不是对应的ID) /// /// /// public async Task CheckMachineByMachineId(string? machineId) { if (string.IsNullOrWhiteSpace(machineId)) { return false; } return await _context.Machine.AnyAsync(x => x.MachineId == machineId); } /// /// 检查机器码是否存在(机器码,对应的ID) /// /// /// public async Task CheckMachineById(string Id) { if (string.IsNullOrWhiteSpace(Id)) { return false; } return await _context.Machine.AnyAsync(x => x.Id == Id); } } }