Fixed money display #1

This commit is contained in:
hydrant
2018-10-20 17:51:03 +02:00
parent 36b3a56401
commit 30ada7aeda
3 changed files with 21 additions and 3 deletions

View File

@@ -1,10 +1,13 @@
using GTANetworkAPI;
using reallife_gamemode.Model;
using reallife_gamemode.Server.Services;
using reallife_gamemode.Server.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
using System.Linq;
/**
* @overview Life of German Reallife - Entities UserBankAccount (UserBankAccount.cs)
@@ -16,6 +19,8 @@ namespace reallife_gamemode.Server.Entities
{
public class UserBankAccount
{
private float _balance;
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
@@ -26,7 +31,17 @@ namespace reallife_gamemode.Server.Entities
public string Bic { get; set; }
[StringLength(32)]
public string Iban { get; set; }
public float Balance { get; set; }
public float Balance {
get => _balance;
set
{
_balance = value;
using(var dbContext = new DatabaseContext())
{
ClientService.GetClientByName(dbContext.Users.First(u => u.Id == UserId).Name).TriggerEvent("updateMoney", value);
}
}
}
public bool Active { get; set; }
}
}