bank account refactor
This commit is contained in:
@@ -14,7 +14,7 @@ using ReallifeGamemode.Server.Types;
|
||||
|
||||
namespace ReallifeGamemode.Database.Entities
|
||||
{
|
||||
public partial class User : IBankAccountOwner
|
||||
public partial class User : BankAccountHolder<UserBankAccount>
|
||||
{
|
||||
[NotMapped]
|
||||
private int _wanteds;
|
||||
@@ -98,27 +98,12 @@ namespace ReallifeGamemode.Database.Entities
|
||||
|
||||
public bool IsAdmin(AdminLevel level) => AdminLevel >= level;
|
||||
|
||||
public IBankAccount GetBankAccount(DatabaseContext databaseContext = null)
|
||||
{
|
||||
if (databaseContext == null)
|
||||
{
|
||||
using (databaseContext = new DatabaseContext())
|
||||
{
|
||||
return databaseContext.UserBankAccounts.FirstOrDefault(u => u.UserId == this.Id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return databaseContext.UserBankAccounts.FirstOrDefault(u => u.UserId == this.Id);
|
||||
}
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public Player Player
|
||||
{
|
||||
get => NAPI.Pools.GetAllPlayers().Where(c => c.Name.ToLower() == this.Name.ToLower()).FirstOrDefault();
|
||||
}
|
||||
|
||||
|
||||
public override string BankAccountName => Name;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user