Add more types of moneytransfer

This commit is contained in:
VegaZ
2018-10-09 21:41:52 +02:00
parent e11d453e27
commit e0bc6ef9aa
6 changed files with 152 additions and 24 deletions

View 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 - Faction Extension (FactionExtension.cs)
* @author VegaZ
* @copyright (c) 2008 - 2018 Life of German
*/
namespace reallife_gamemode.Server.Extensions
{
public static class FactionExtension
{
public static FactionBankAccount GetFactionBankAccount(this Faction faction, DatabaseContext context = null)
{
using (DatabaseContext dbContext = new DatabaseContext())
if (context == null)
{
using (context = new DatabaseContext())
{
return context.FactionBankAccounts.FirstOrDefault(u => u.FactionId == faction.Id);
}
}
else
{
return context.FactionBankAccounts.FirstOrDefault(u => u.FactionId == faction.Id);
}
}
}
}