Account constructor with int calling other constructor

This commit is contained in:
2021-09-17 10:46:39 -04:00
parent 4eaf226349
commit 558c02ac02
2 changed files with 6 additions and 7 deletions

View File

@ -19,8 +19,7 @@ namespace NightmareCoreWeb2
public List<Character> Characters { get; set; }
public List<AccountAccess> Access { get; set; }
public static Account AccountByID(int id)
public Account(int id)
{
MySqlConnection conn = new MySqlConnection(Program.connStr);
@ -33,7 +32,7 @@ namespace NightmareCoreWeb2
{
try
{
return new Account(rdr.GetString(0));
new Account(rdr.GetString(0));
}
catch (Exception e)
@ -41,9 +40,9 @@ namespace NightmareCoreWeb2
Console.WriteLine(e);
}
}
return null;
}
public Account(string username)
{
MySqlConnection conn = new MySqlConnection(Program.connStr);

View File

@ -66,11 +66,11 @@ namespace NightmareCoreWeb2
this.LastModifiedTime = DateTimeOffset.FromUnixTimeSeconds(rdr.GetInt32(3)).UtcDateTime;
if (rdr.GetInt32(4) != 0)
{
this.ClosedBy = Account.AccountByID(rdr.GetInt32(4));
this.ClosedBy = new Account(rdr.GetInt32(4));
}
if (rdr.GetInt32(5) != 0)
{
this.AssignedTo = Account.AccountByID(rdr.GetInt32(5));
this.AssignedTo = new Account(rdr.GetInt32(5));
}
this.Description = rdr.GetString(6);
}