WebGame.Game.Join C# (CSharp) Method

Join() public method

public Join ( int accountId, string name, int rating ) : Player
accountId int
name string
rating int
return Player
        public Player Join(int accountId, string name, int rating)
        {
            var result = new Player() { AccountId = accountId, Name = name, Rating = rating };
            Join(result);
            return result;
        }

Same methods

Game::Join ( Player player ) : void

Usage Example

Exemplo n.º 1
0
        public ActionResult Create(Game model)
        {
            if (ModelState.IsValid)
            {
                GameServer.SaveNewGame(model);

                model.Join(Account.Id, Account.Name, Account.Rating);
                GameServer.PlayerJoined(model, Account.Id);

                return Redirect("/Game-" + model.Id + "/");
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }