public LeaderBoardController()
 {
     PlayerDbContext Context = new PlayerDbContext();
     players = new GenericRepository<Player>(new StorageContext<Player>(Context));
 }
Example #2
0
 public bool PerformAction(PlayerDbContext db)
 {
     switch (type)
     {
         case AdminActionType.AddPoints:
             return player.addPoints(modifyTarget.Value, value.Value);
         case AdminActionType.RemovePoints:
             return player.addPoints(modifyTarget.Value, -value.Value);
         case AdminActionType.FreezeAccount:
             if (player.freezeInfo == null)
             {
                 player.freezeInfo = new FreezeInfo { freezeDate = DateTime.Now, reason = reason, player = player };
                 return true;
             }
             break;
         case AdminActionType.UnfreezeAccount:
             if (player.freezeInfo != null)
             {
                 player.freezeInfo.addPointsToPlayer();
                 db.freezeInfos.Remove(player.freezeInfo);
                 return true;
             }
             break;
         default:
             break;
     }
     return false;
 }