Add more types of moneytransfer
This commit is contained in:
36
Server/Extensions/UserExtension.cs
Normal file
36
Server/Extensions/UserExtension.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using GTANetworkAPI;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using reallife_gamemode.Model;
|
||||
using reallife_gamemode.Server.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
/**
|
||||
* @overview Life of German Reallife - User Extension (UserExtension.cs)
|
||||
* @author VegaZ
|
||||
* @copyright (c) 2008 - 2018 Life of German
|
||||
*/
|
||||
|
||||
namespace reallife_gamemode.Server.Extensions
|
||||
{
|
||||
public static class UserExtension
|
||||
{
|
||||
public static UserBankAccount GetUserBankAccount(this User user, DatabaseContext context = null)
|
||||
{
|
||||
using (DatabaseContext dbContext = new DatabaseContext())
|
||||
if (context == null)
|
||||
{
|
||||
using (context = new DatabaseContext())
|
||||
{
|
||||
return context.UserBankAccounts.FirstOrDefault(u => u.UserId == user.Id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return context.UserBankAccounts.FirstOrDefault(u => u.UserId == user.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user