/// <summary> /// Updates the cache with the latest information from this entity. /// This should be called after changing a player store's details. /// </summary> /// <param name="playerId">The store owner's player Id</param> /// <param name="dbPlayerStore">The player store entity</param> public static void UpdateCacheEntry(string playerId, PlayerStore dbPlayerStore) { if (IsStoreOpen(dbPlayerStore)) { ActiveStoreNames[playerId] = dbPlayerStore.StoreName; } else { if (ActiveStoreNames.ContainsKey(playerId)) { ActiveStoreNames.Remove(playerId); } } }
/// <summary> /// Retrieves all of the active stores. /// </summary> /// <returns>A dictionary containing all of the active stores.</returns> public static Dictionary <string, string> GetAllActiveStores() { return(ActiveStoreNames.ToDictionary(x => x.Key, y => y.Value)); }