bank account refactor
This commit is contained in:
@@ -17,28 +17,30 @@ namespace ReallifeGamemode.Database.Entities
|
||||
[NotMapped]
|
||||
private int _balance;
|
||||
|
||||
public delegate void BankAccountBalanceChangedEvent(UserBankAccount account);
|
||||
public static event BankAccountBalanceChangedEvent BalanceChanged;
|
||||
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
[ForeignKey("User")]
|
||||
public int UserId { get; set; }
|
||||
public User User { get; set; }
|
||||
|
||||
[StringLength(12)]
|
||||
public string Bic { get; set; }
|
||||
|
||||
[StringLength(32)]
|
||||
public string Iban { get; set; }
|
||||
|
||||
public int Balance
|
||||
{
|
||||
get => _balance;
|
||||
|
||||
set
|
||||
{
|
||||
_balance = value;
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
PlayerService.GetPlayerByNameOrId(dbContext.Users.First(u => u.Id == UserId).Name).TriggerEvent("updateMoney", value);
|
||||
}
|
||||
BalanceChanged?.Invoke(this);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Active { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user