/// <summary> /// Adds an item to a player's inventory in the database. /// </summary> /// <param name="playerID"></param> /// <param name="item"></param> public void addPlayerInventoryItem(int playerID, DomainClasses.SceneComponent item) { connection.Insert(new PlayerInventory { playerID = playerID, componentID = item.identifier }); connection.Close(); }
/// <summary> /// Removes a scene component from a scene's inventory in the database. /// </summary> /// <param name="gameID"></param> /// <param name="scene"></param> /// <param name="item"></param> public void removeSceneComponent(int gameID, DomainClasses.Scene scene, DomainClasses.SceneComponent item) { DTO.SceneInventory itemToRemove = connection.Table <DTO.SceneInventory>().Where(x => x.gameID == gameID && x.sceneID == scene.identifier && x.componentID == item.identifier).ToArray().FirstOrDefault(); if (itemToRemove != null) { connection.Delete <SceneInventory>(itemToRemove.identifier); } }
/// <summary> /// Removes an item from the player's inventory in the database. /// </summary> /// <param name="playerID"></param> /// <param name="item"></param> public void removePlayerInventoryItem(int playerID, DomainClasses.SceneComponent item) { PlayerInventory itemToRemove = connection.Table <PlayerInventory>().Where(x => x.playerID == playerID && x.componentID == item.identifier).ToArray().FirstOrDefault(); if (itemToRemove != null) { connection.Delete <PlayerInventory>(itemToRemove.identifier); } }
/// <summary> /// Adds a scene component to a scene's inventory in the database. /// </summary> /// <param name="gameID"></param> /// <param name="scene"></param> /// <param name="item"></param> public void addSceneComponent(int gameID, DomainClasses.Scene scene, DomainClasses.SceneComponent item) { connection.Insert(new DTO.SceneInventory { gameID = gameID, sceneID = scene.identifier, componentID = item.identifier }); }