Faction is not null on Client.GetUser() anymore

This commit is contained in:
hydrant
2019-03-10 13:01:34 +01:00
parent 008590d694
commit 4180873081

View File

@@ -1,4 +1,5 @@
using GTANetworkAPI;
using Microsoft.EntityFrameworkCore;
using ReallifeGamemode.Server.Entities;
using ReallifeGamemode.Server.Models;
using System;
@@ -28,12 +29,20 @@ namespace ReallifeGamemode.Server.Extensions
{
using (context = new DatabaseContext())
{
return context.Users.FirstOrDefault(u => u.Name == client.Name);
return context
.Users
.Include(u => u.Faction)
.Include(u => u.FactionRank)
.FirstOrDefault(u => u.Name == client.Name);
}
}
else
{
return context.Users.FirstOrDefault(u => u.Name == client.Name);
return context
.Users
.Include(u => u.Faction)
.Include(u => u.FactionRank)
.FirstOrDefault(u => u.Name == client.Name);
}
}