Simplified bank money transfer
This commit is contained in:
@@ -1,41 +0,0 @@
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Gibt das Bankkonto einer Fraktion zurück
|
||||
/// </summary>
|
||||
/// <param name="faction">Die Fraktion, dessen Bankkonto man bekommen möchte</param>
|
||||
/// <param name="context">Ein eventuell vorhandener Datenbank-Context, falls man Änderungen in der Datenbank vornehmen will</param>
|
||||
/// <returns></returns>
|
||||
public static FactionBankAccount GetFactionBankAccount(this Faction faction, DatabaseContext context = null)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Gibt das Bankkonto eines Users zurück
|
||||
/// </summary>
|
||||
/// <param name="user">Der User, dessen Bankkonto man bekommen möchte</param>
|
||||
/// <param name="context">Ein eventuell vorhandener Datenbank-Context, falls man Änderungen in der Datenbank vornehmen will</param>
|
||||
/// <returns></returns>
|
||||
public static UserBankAccount GetUserBankAccount(this User user, DatabaseContext context = null)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gibt den Character eines Users zurück
|
||||
/// </summary>
|
||||
/// <param name="user">Der Client, dessen Character man bekommen möchte</param>
|
||||
/// <param name="context">Ein eventuell vorhandener Datenbank-Context, falls man Änderungen in der Datenbank vornehmen will</param>
|
||||
/// <returns></returns>
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user