mirror-ac/server/Database/Entity/HardwareConfiguration.cs

38 lines
1.1 KiB
C#
Raw Normal View History

using Serilog;
2023-09-09 17:36:19 +02:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using server.Database.Model;
using System.Reflection.Metadata.Ecma335;
using Microsoft.EntityFrameworkCore;
namespace server.Database.Entity
{
public class HardwareConfigurationEntity : HardwareConfiguration
{
private readonly ModelContext _modelContext;
public UserEntity UserEntity { get; set; }
2023-09-09 17:36:19 +02:00
public HardwareConfigurationEntity(ModelContext modelContext)
{
UserEntity = new UserEntity(modelContext);
2023-09-09 17:36:19 +02:00
_modelContext = modelContext;
}
public bool CheckIfHardwareIsBanned()
2023-09-09 17:36:19 +02:00
{
return _modelContext.HardwareConfiguration.Any(
h => h.MotherboardSerial == MotherboardSerial &&
h.DeviceDrive0Serial == DeviceDrive0Serial &&
h.IsBanned);
}
public void InsertHardwareConfiguration()
{
_modelContext.HardwareConfiguration.Add(this);
2023-09-09 17:36:19 +02:00
}
}
}