MfG, DimGamer
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using ReallifeGamemode.Database.Models;
|
||||
|
||||
/**
|
||||
@@ -13,21 +15,13 @@ namespace ReallifeGamemode.Database.Entities
|
||||
[Table("FactionVehicles")]
|
||||
public partial class FactionVehicle : ServerVehicle
|
||||
{
|
||||
[ForeignKey("Faction")]
|
||||
public int? FactionId { get; set; }
|
||||
public Faction Faction { get; set; }
|
||||
public string Owners { get; set; }
|
||||
|
||||
public Faction GetFaction()
|
||||
{
|
||||
using (var context = new DatabaseContext())
|
||||
{
|
||||
return context.Factions.FirstOrDefault(f => f.Id == FactionId);
|
||||
}
|
||||
}
|
||||
public List<int> GetOwners() => JsonConvert.DeserializeObject<List<int>>(Owners);
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "Fraktions Fahrzeug | Fraktion: " + GetFaction().Name;
|
||||
return "Fraktions Fahrzeug | Fraktion: " + string.Join(", ", GetOwners());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user