Feature/character creator

This commit is contained in:
VegaZ
2018-10-24 20:51:54 +02:00
parent 5d581ed66d
commit ae6801cedb
14 changed files with 1184 additions and 15 deletions

View File

@@ -1,5 +1,7 @@
using GTANetworkAPI;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using reallife_gamemode.Model;
using reallife_gamemode.Server.Entities;
using System;

View File

@@ -31,5 +31,19 @@ namespace reallife_gamemode.Server.Extensions
return context.UserBankAccounts.FirstOrDefault(u => u.UserId == user.Id);
}
}
public static Character GetUserCharacter(this User user, DatabaseContext context = null)
{
if (context == null)
{
using (context = new DatabaseContext())
{
return context.Characters.FirstOrDefault(u => u.UserId == user.Id);
}
}
else
{
return context.Characters.FirstOrDefault(u => u.UserId == user.Id);
}
}
}
}