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 Serilog;
|
|
|
|
|
|
|
|
|
|
namespace server.Database.Entity
|
|
|
|
|
{
|
|
|
|
|
public class UserEntity : User
|
|
|
|
|
{
|
|
|
|
|
private readonly ModelContext _modelContext;
|
|
|
|
|
|
2023-09-10 12:20:35 +02:00
|
|
|
|
public UserEntity(ModelContext modelContext)
|
2023-09-09 17:36:19 +02:00
|
|
|
|
{
|
|
|
|
|
_modelContext = modelContext;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool CheckIfUserExists()
|
|
|
|
|
{
|
|
|
|
|
return _modelContext.Users.Any(u => u.Steam64Id == Steam64Id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool CheckIfUserIsBanned()
|
|
|
|
|
{
|
|
|
|
|
return _modelContext.Users.Any(u => u.Steam64Id == Steam64Id && u.IsBanned);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void InsertUser()
|
|
|
|
|
{
|
|
|
|
|
_modelContext.Users.Add(this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|