44 lines
1.2 KiB
C#
44 lines
1.2 KiB
C#
|
|
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);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|