public User AddGameNick(User accessToken, GameNick gameNick) { GameNickEntities entities = new GameNickEntities(); if (IsAuthenticated(accessToken, entities)) { if( (gameNick.UserID == accessToken.ID) && (gameNick.GameID > 0) && (gameNick.Name != string.Empty)) { entities.AddToGameNicks(gameNick); entities.SaveChanges(); return GetMe(entities, accessToken.ID); } else { throw new InvalidDataException(); } } throw new SecurityAccessDeniedException(); }
public User RemoveGameNick(User accessToken, GameNick gameNick) { GameNickEntities entities = new GameNickEntities(); if (IsAuthenticated(accessToken, entities)) { entities.Attach(gameNick); entities.DeleteObject(gameNick); entities.SaveChanges(); return GetMe(entities, accessToken.ID); } throw new SecurityAccessDeniedException(); }
/// <summary> /// Create a new GameNick object. /// </summary> /// <param name="userID">Initial value of the UserID property.</param> /// <param name="gameID">Initial value of the GameID property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="id">Initial value of the ID property.</param> public static GameNick CreateGameNick(global::System.Int32 userID, global::System.Int32 gameID, global::System.String name, global::System.Int32 id) { GameNick gameNick = new GameNick(); gameNick.UserID = userID; gameNick.GameID = gameID; gameNick.Name = name; gameNick.ID = id; return gameNick; }
/// <summary> /// Deprecated Method for adding a new object to the GameNicks EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToGameNicks(GameNick gameNick) { base.AddObject("GameNicks", gameNick); }