BattleShip.Web.Controllers.GameController.Create C# (CSharp) Method

Create() public method

public Create ( string name, string myemail, string opponentemail ) : System.Web.Mvc.JsonResult
name string
myemail string
opponentemail string
return System.Web.Mvc.JsonResult
        public JsonResult Create(string name, string myemail, string opponentemail)
        {
            var gameId = MvcApplication.GameHost.CreateGame(name, myemail, myemail, opponentemail, opponentemail);
            MvcApplication.GameHost.SetPlayerLocation(gameId, myemail, GetRandomCenter());
            MvcApplication.GameHost.SetPlayerLocation(gameId, opponentemail, GetRandomCenter());

            this.Session[MagicStrings.SessionGameId] = gameId;
            this.Session[MagicStrings.SessionPlayerEmail] = myemail;

            SendEmail(gameId.ToString(), opponentemail);
            SendEmail(gameId.ToString(), myemail);

            return this.Json(null, JsonRequestBehavior.AllowGet);
        }