Browse Source

Move IsGM to Account class

master
Gregory Rudolph 3 years ago
parent
commit
3ea07adf46
Signed by: rudi
GPG Key ID: EF64F3CBD1A1EBDD
  1. 8
      Account.cs
  2. 2
      Pages/Account.cshtml
  3. 8
      Pages/Account.cshtml.cs

8
Account.cs

@ -10,6 +10,7 @@ namespace NightmareCoreWeb2
public class Account public class Account
{ {
public UInt32 Id { get; set; } public UInt32 Id { get; set; }
public bool IsGM {get; set;}
public string Username { get; set; } public string Username { get; set; }
public string Email { get; set; } public string Email { get; set; }
public string LastIP { get; set; } public string LastIP { get; set; }
@ -113,6 +114,13 @@ namespace NightmareCoreWeb2
{ {
Console.WriteLine(e); Console.WriteLine(e);
} }
}
foreach (var access in this.Access)
{
if (access.RealmID == -1 && access.RealmID >= 1)
{
this.IsGM = true;
}
} }
rdr.Close(); rdr.Close();

2
Pages/Account.cshtml

@ -55,7 +55,7 @@
</div> </div>
<br /> <br />
<div class="container" style="display: flex; flex-wrap: wrap;"> <div class="container" style="display: flex; flex-wrap: wrap;">
@if (Model.IsGM) @if (Model.UserAccount.IsGM)
{ {
@foreach (var ticket in Model.Tickets) @foreach (var ticket in Model.Tickets)
{ {

8
Pages/Account.cshtml.cs

@ -14,7 +14,6 @@ namespace NightmareCoreWeb2.Pages
public string CharacterListType { get; set; } public string CharacterListType { get; set; }
public string AuthToken { get; set; } public string AuthToken { get; set; }
public string Username { get; set; } public string Username { get; set; }
public bool IsGM { get; set; }
public bool IsAuthenticated = false; public bool IsAuthenticated = false;
public Account UserAccount { get; set; } public Account UserAccount { get; set; }
public List<Character> OnlineCharacters = new List<Character>(); public List<Character> OnlineCharacters = new List<Character>();
@ -81,14 +80,9 @@ namespace NightmareCoreWeb2.Pages
Account a = new Account(Username); Account a = new Account(Username);
UserAccount = a; UserAccount = a;
OnlineCharacters = a.Characters; OnlineCharacters = a.Characters;
foreach (var access in a.Access) if (a.IsGM) {
{
if (access.RealmID == -1 && access.RealmID >= 1)
{
this.IsGM = true;
this.Tickets = GMTicket.GetAllTickets(); this.Tickets = GMTicket.GetAllTickets();
} }
}
ViewData["Title"] = a.Username; ViewData["Title"] = a.Username;
CharacterListType = $"{a.Username}'s Characters"; CharacterListType = $"{a.Username}'s Characters";
this.UserAccount = a; this.UserAccount = a;

Loading…
Cancel
Save