public Game CreateGame(Player challenger, Player opponent) { var game = new Game { Challenger = challenger, Opponent = opponent, GameStatus = _context.GameStatus1.First(s => s.Status == "Create"), }; _context.Games.Attach(game); _context.SaveChanges(); return game; }
public Game CreateGame(Player challenger, Player opponent) { var game = new Game { Challenger = challenger, Opponent = opponent, Status = GameStatus.SettingUp, GamePieces = _gamePiecesService.GenerateGamePieces(challenger.Id, opponent.Id) }; _context.Games.Add(game); _context.SaveChanges(); return game; }
/// <summary> /// Create a new Game object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="createdOn">Initial value of the CreatedOn property.</param> /// <param name="updatedOn">Initial value of the UpdatedOn property.</param> /// <param name="gameStatusId">Initial value of the GameStatusId property.</param> public static Game CreateGame(global::System.Int32 id, global::System.DateTime createdOn, global::System.DateTime updatedOn, global::System.Int32 gameStatusId) { Game game = new Game(); game.Id = id; game.CreatedOn = createdOn; game.UpdatedOn = updatedOn; game.GameStatusId = gameStatusId; return game; }
/// <summary> /// Deprecated Method for adding a new object to the Games EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToGames(Game game) { base.AddObject("Games", game); }