Added /remove command for vehicles and goto points

This commit is contained in:
hydrant
2018-12-02 15:00:41 +01:00
parent c5be51f3aa
commit 938e30fa96
4 changed files with 99 additions and 2 deletions

View File

@@ -1,9 +1,11 @@
using GTANetworkAPI;
using reallife_gamemode.Model;
using reallife_gamemode.Server.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
/**
@@ -20,5 +22,25 @@ namespace reallife_gamemode.Server.Entities
[ForeignKey("User")]
public int UserId { get; set; }
public User User { get; set; }
public override string ToString()
{
return "Spieler Fahrzeug | Besitzer: " + GetOwner().Name;
}
public User GetOwner(DatabaseContext dbContext = null)
{
if (dbContext == null)
{
using (dbContext = new DatabaseContext())
{
return dbContext.Users.FirstOrDefault(u => u.BusinessId == Id);
}
}
else
{
return dbContext.Users.FirstOrDefault(u => u.BusinessId == Id);
}
}
}
}