Esempio n. 1
0
 public void CreatePlayer(string email, string displayName, string faceBookId)
 {
     var player = new Player
     {
         DisplayName = displayName,
         Email = email,
         FaceBookId = faceBookId
     };
     player.TotalPoints += 1000;
     _context.Players.Add(player);
     _context.SaveChanges();
 }
Esempio n. 2
0
 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;
 }
Esempio n. 3
0
 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>
 /// Deprecated Method for adding a new object to the Players EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToPlayers(Player player)
 {
     base.AddObject("Players", player);
 }
 /// <summary>
 /// Create a new Player object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="streak">Initial value of the Streak property.</param>
 /// <param name="wins">Initial value of the Wins property.</param>
 /// <param name="loses">Initial value of the Loses property.</param>
 /// <param name="totalPoints">Initial value of the TotalPoints property.</param>
 /// <param name="createdOn">Initial value of the CreatedOn property.</param>
 /// <param name="updatedOn">Initial value of the UpdatedOn property.</param>
 public static Player CreatePlayer(global::System.Int32 id, global::System.Int32 streak, global::System.Int32 wins, global::System.Int32 loses, global::System.Int32 totalPoints, global::System.DateTime createdOn, global::System.DateTime updatedOn)
 {
     Player player = new Player();
     player.Id = id;
     player.Streak = streak;
     player.Wins = wins;
     player.Loses = loses;
     player.TotalPoints = totalPoints;
     player.CreatedOn = createdOn;
     player.UpdatedOn = updatedOn;
     return player;
 }