diff --git a/Website/LOC.Website.Common/Models/AccountAdministrator.cs b/Website/LOC.Website.Common/Models/AccountAdministrator.cs index b205de2ef..5aa571908 100644 --- a/Website/LOC.Website.Common/Models/AccountAdministrator.cs +++ b/Website/LOC.Website.Common/Models/AccountAdministrator.cs @@ -93,9 +93,6 @@ { var account = repository.Where(x => x.Uuid == loginToken.Uuid).FirstOrDefault(); - if (account == default(Account)) - account = repository.Where(x => x.Name == loginToken.Name).FirstOrDefault(); - if (account == default(Account)) account = CreateAccount(loginToken, repository); @@ -241,7 +238,7 @@ { using (var repository = _repositoryFactory.CreateRepository()) { - var account = repository.Where(x => x.Name == token.Name).FirstOrDefault(); + var account = repository.Where(x => x.Name == token.Name).OrderByDescending(x => x.LastLogin).FirstOrDefault(); if (account == null) return false; @@ -268,7 +265,7 @@ using (var repository = _repositoryFactory.CreateRepository()) { - var account = repository.Where(x => x.Name == token.Name).FirstOrDefault(); + var account = repository.Where(x => x.Name == token.Name).OrderByDescending(x => x.LastLogin).FirstOrDefault(); if (account == null) return false; @@ -287,7 +284,7 @@ { using (var repository = _repositoryFactory.CreateRepository()) { - var account = repository.Where(x => x.Name == token.Name).FirstOrDefault(); + var account = repository.Where(x => x.Name == token.Name).OrderByDescending(x => x.LastLogin).FirstOrDefault(); if (account == null) return false; @@ -314,7 +311,7 @@ using (var repository = _repositoryFactory.CreateRepository()) { - var account = repository.Where(x => x.Name == token.Name).FirstOrDefault(); + var account = repository.Where(x => x.Name == token.Name).OrderByDescending(x => x.LastLogin).FirstOrDefault(); if (account == null) return false; @@ -331,7 +328,7 @@ { using (var repository = _repositoryFactory.CreateRepository()) { - var account = repository.Where(x => x.Name == token.Name).Include(x => x.Tasks).FirstOrDefault(); + var account = repository.Where(x => x.Name == token.Name).OrderByDescending(x => x.LastLogin).Include(x => x.Tasks).FirstOrDefault(); if (account != null) { @@ -356,7 +353,7 @@ { using (var repository = _repositoryFactory.CreateRepository()) { - var account = repository.Where(x => x.Name == punish.Target).Include(x => x.Rank).FirstOrDefault(); + var account = repository.Where(x => x.Name == punish.Target).OrderByDescending(x => x.LastLogin).Include(x => x.Rank).FirstOrDefault(); if (account == null) return PunishmentResponse.AccountDoesNotExist; @@ -364,7 +361,7 @@ if (!String.Equals(punish.Admin, "Mineplex Enjin Server")) { var punisher = - repository.Where(x => x.Name == punish.Admin).Include(x => x.Rank).FirstOrDefault(); + repository.Where(x => x.Name == punish.Admin).OrderByDescending(x => x.LastLogin).Include(x => x.Rank).FirstOrDefault(); if (punisher == null) return PunishmentResponse.NotPunished; @@ -399,7 +396,7 @@ { using (var repository = _repositoryFactory.CreateRepository()) { - var account = repository.Where(x => x.Name == token.Target).Include(x => x.Punishments).FirstOrDefault(); + var account = repository.Where(x => x.Name == token.Target).OrderByDescending(x => x.LastLogin).Include(x => x.Punishments).FirstOrDefault(); if (account == null) return PunishmentResponse.AccountDoesNotExist; @@ -436,7 +433,7 @@ using (var repository = _repositoryFactory.CreateRepository()) { var account = - repository.Where(x => x.Name == token.AccountName) + repository.Where(x => x.Name == token.AccountName).OrderByDescending(x => x.LastLogin) .Include(x => x.PvpTransactions) .First(); @@ -496,7 +493,7 @@ using (var repository = _repositoryFactory.CreateRepository()) { var account = - repository.Where(x => x.Name == token.PlayerName).Include(x => x.CustomBuilds).First(); + repository.Where(x => x.Name == token.PlayerName).OrderByDescending(x => x.LastLogin).Include(x => x.CustomBuilds).First(); var customBuild = account.CustomBuilds.FirstOrDefault( @@ -538,7 +535,7 @@ { using (var repository = _repositoryFactory.CreateRepository()) { - var account = repository.Where(x => x.Name == accountName).First(); + var account = repository.Where(x => x.Name == accountName).OrderByDescending(x => x.LastLogin).First(); account.IgnoredPlayers.Add(ignoredPlayer); @@ -550,7 +547,7 @@ { using (var repository = _repositoryFactory.CreateRepository()) { - var account = repository.Where(x => x.Name == accountName).First(); + var account = repository.Where(x => x.Name == accountName).OrderByDescending(x => x.LastLogin).First(); account.IgnoredPlayers.Remove(ignoredPlayer); @@ -568,6 +565,7 @@ { var account = repository.Where(x => x.Name == token.AccountName) + .OrderByDescending(x => x.LastLogin) .Include(x => x.AccountTransactions) .First(); @@ -617,7 +615,7 @@ { using (var repository = _repositoryFactory.CreateRepository()) { - var account = repository.Where(x => String.Equals(x.Name, name)).Include(x => x.Rank).FirstOrDefault(); + var account = repository.Where(x => String.Equals(x.Name, name)).OrderByDescending(x => x.LastLogin).Include(x => x.Rank).FirstOrDefault(); account.LoadNavigationProperties(repository.Context); addAccountTransaction(repository, account, "Bacon Brawl Bebe Piggles", 0, 0); @@ -700,7 +698,7 @@ { using (var repository = _repositoryFactory.CreateRepository()) { - var account = repository.Where(x => String.Equals(x.Name, token.Name)).Include(x => x.Rank).FirstOrDefault(); + var account = repository.Where(x => String.Equals(x.Name, token.Name)).OrderByDescending(x => x.LastLogin).Include(x => x.Rank).FirstOrDefault(); rank = repository.Where(x => String.Equals(x.Name, token.Rank)).FirstOrDefault(); if (account == null) @@ -724,7 +722,7 @@ using (var repository = _repositoryFactory.CreateRepository()) { - var account = repository.Where(x => String.Equals(x.Name, token.Name)).Include(x => x.Rank).FirstOrDefault(); + var account = repository.Where(x => String.Equals(x.Name, token.Name)).OrderByDescending(x => x.LastLogin).Include(x => x.Rank).FirstOrDefault(); if (token.Retries >= 3) _logger.Log("ERROR", "Applying UpdateRank, retried 3 times and something didn't stick."); @@ -747,7 +745,7 @@ { using (var repository = _repositoryFactory.CreateRepository()) { - var account = repository.Where(x => x.Name == token.Target).Include(x => x.Punishments).FirstOrDefault(); + var account = repository.Where(x => x.Name == token.Target).OrderByDescending(x => x.LastLogin).Include(x => x.Punishments).FirstOrDefault(); if (account == null) return; diff --git a/Website/LOC.Website.Web/LOC.Website.Web.Publish.xml b/Website/LOC.Website.Web/LOC.Website.Web.Publish.xml index 3aaebf02d..2d91aaa08 100644 --- a/Website/LOC.Website.Web/LOC.Website.Web.Publish.xml +++ b/Website/LOC.Website.Web/LOC.Website.Web.Publish.xml @@ -7,7 +7,6 @@ - @@ -18,7 +17,7 @@ - + @@ -27,27 +26,27 @@ - - + - + - + + @@ -61,9 +60,10 @@ - + + @@ -78,7 +78,9 @@ + + @@ -92,12 +94,11 @@ - - + @@ -107,17 +108,17 @@ - + - + + - + - @@ -125,24 +126,22 @@ - - + - + - - + @@ -156,7 +155,7 @@ - + @@ -176,8 +175,8 @@ - - + + @@ -188,13 +187,12 @@ - - + @@ -215,16 +213,16 @@ - + - + - + - + @@ -239,14 +237,15 @@ - + - + + - + @@ -261,12 +260,14 @@ + + @@ -280,27 +281,28 @@ - + + + - - + - + @@ -319,7 +321,6 @@ - @@ -335,8 +336,6 @@ - - @@ -348,7 +347,6 @@ - @@ -365,17 +363,20 @@ + - + + + @@ -388,16 +389,17 @@ + - + - + @@ -409,7 +411,7 @@ - + @@ -437,10 +439,9 @@ - - + @@ -448,7 +449,6 @@ - @@ -461,13 +461,13 @@ - + - + @@ -481,7 +481,7 @@ - + @@ -500,9 +500,9 @@ - + - + @@ -516,7 +516,7 @@ - + @@ -526,10 +526,11 @@ - + + @@ -543,28 +544,29 @@ - + - + + - + - + @@ -582,7 +584,7 @@ - + @@ -599,8 +601,6 @@ - - @@ -611,10 +611,10 @@ - + @@ -622,24 +622,23 @@ - - + + - - + - + @@ -649,13 +648,15 @@ - + + + @@ -673,13 +674,13 @@ - + - + @@ -694,16 +695,15 @@ - + - + - - + @@ -711,7 +711,6 @@ - @@ -724,13 +723,13 @@ - + - + - + @@ -744,11 +743,12 @@ + - + - + @@ -763,9 +763,9 @@ - + - + @@ -779,7 +779,7 @@ - + @@ -793,6 +793,7 @@ + @@ -806,28 +807,29 @@ - + - + + - + - + @@ -862,8 +864,6 @@ - - @@ -874,10 +874,10 @@ - + @@ -890,19 +890,18 @@ - - + - + @@ -912,13 +911,15 @@ - + + + @@ -936,13 +937,13 @@ - + - + @@ -963,10 +964,9 @@ - - + @@ -974,7 +974,6 @@ - @@ -987,13 +986,13 @@ - + - + - + @@ -1007,8 +1006,9 @@ + - + @@ -1026,9 +1026,9 @@ - + - + @@ -1042,7 +1042,7 @@ - + diff --git a/Website/LOCWebsite.suo b/Website/LOCWebsite.suo index e04015bc9..2b103f237 100644 Binary files a/Website/LOCWebsite.suo and b/Website/LOCWebsite.suo differ