/// <summary> /// Convert a WCF Game object into a Game Entity object /// </summary> /// <param name="game"></param> /// <returns></returns> private Game WCFToGame(GameWcf game) { Game ret = new Game(); ret.ID = game.ID; ret.IP = game.IP; ret.NumOfUsers = game.numOfPlayers; ret.FirstUser = game.FirstUser; ret.SecondUser = game.SecondUser; return ret; }
/// <summary> /// convert a Game Entity object to a WCF Game object /// </summary> /// <param name="game"></param> /// <returns></returns> private GameWcf gameToWCF(Game game){ GameWcf ret = new GameWcf(); ret.ID = game.ID; ret.IP = game.IP; ret.numOfPlayers = game.NumOfUsers; ret.FirstUser = game.FirstUser; ret.SecondUser = game.SecondUser; return ret; }
/// <summary> /// Create a new Game object. /// </summary> /// <param name="id">Initial value of the ID property.</param> /// <param name="iP">Initial value of the IP property.</param> /// <param name="firstUser">Initial value of the FirstUser property.</param> /// <param name="numOfUsers">Initial value of the NumOfUsers property.</param> public static Game CreateGame(global::System.Int32 id, global::System.String iP, global::System.String firstUser, global::System.Int32 numOfUsers) { Game game = new Game(); game.ID = id; game.IP = iP; game.FirstUser = firstUser; game.NumOfUsers = numOfUsers; return game; }
/// <summary> /// Remove a game from the DB /// </summary> /// <param name="game">Game to Remove</param> public void removeGame(Game game) { using (BlackJackDataEntities ctx = new BlackJackDataEntities()) { ctx.Game.Attach(game); ctx.DeleteObject(game); ctx.SaveChanges(); } }
/// <summary> /// Deprecated Method for adding a new object to the Game EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToGame(Game game) { base.AddObject("Game", game); }