public ActionResult <Player> AddPlayer(Player player)
 {
     player = _game.GameAddPlayer(player);
     return(player);
     //test below
     //Player p1 = _game.TestCache();
     //p1.Name = p1.Name + " back again!";
     //return p1;
     //test above
 }
Esempio n. 2
0
        public ActionResult <Player> AddPlayer(Player player)
        {
            player = _game.GameAddPlayer(player);

            //if(player.PlayerId == -1)
            //{
            //	Player pHighId = players.OrderByDescending(p => p.PlayerId).FirstOrDefault();
            //	if(pHighId == null)
            //	{
            //		player.PlayerId = 1;
            //	}
            //	else{
            //		player.PlayerId = pHighId.PlayerId + 1;
            //	}
            //	_cache.Set("loggedInPlayer", player);//set this player as the player logged in.
            //	players.Add(player);
            //	SaveChanges();
            //}
            return(player);
        }
 /// <summary>
 /// takes a player object and gives a new player(if they are new)) the highest id then calls the Welcone view
 /// </summary>
 /// <param name="player"></param>
 /// <returns></returns>
 public IActionResult AddPlayer(Player player)
 {
     player = _game.GameAddPlayer(player);
     return(View(player));
 }