LMS.service/LMS.DAO/MachineDAO/MachineBasicDao.cs
2024-10-13 17:04:47 +08:00

44 lines
1.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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);
}
}
}