Fixed EF error, edit commands, fix faction broadcast
This commit is contained in:
@@ -21,9 +21,9 @@ namespace reallife_gamemode.Server.Extensions
|
||||
{
|
||||
if(context == null)
|
||||
{
|
||||
using (DatabaseContext dbContext = new DatabaseContext())
|
||||
using (context = new DatabaseContext())
|
||||
{
|
||||
return dbContext.Users.FirstOrDefault(u => u.Name == client.Name);
|
||||
return context.Users.FirstOrDefault(u => u.Name == client.Name);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -36,14 +36,18 @@ namespace reallife_gamemode.Server.Extensions
|
||||
{
|
||||
if(context == null)
|
||||
{
|
||||
using (DatabaseContext dbContext = new DatabaseContext())
|
||||
using(context = new DatabaseContext())
|
||||
{
|
||||
return dbContext.Factions.Find(client.GetUser(context).Faction);
|
||||
User u = client.GetUser();
|
||||
if (u == null) return null;
|
||||
return context.Factions.FirstOrDefault(f => f.Id == u.FactionId);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return context.Factions.Find(client.GetUser(context).Faction);
|
||||
User u = client.GetUser();
|
||||
if (u == null) return null;
|
||||
return context.Factions.FirstOrDefault(f => f.Id == u.FactionId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user