Exemple #1
0
        public async static Task <string> GetCustomSessionValue(this ISessionBagService sessionBagService, string sessionKey)
        {
            var customSessionValues = await sessionBagService.CustomSessionValues();

            if (customSessionValues != null && customSessionValues.ContainsKey(sessionKey))
            {
                return(customSessionValues[sessionKey]);
            }
            return(null);
        }
Exemple #2
0
        public static async Task SetCustomSessionValue(this ISessionBagService sessionBagService, string sessionKey, string value)
        {
            var customSessionValues = await sessionBagService.CustomSessionValues();

            if (customSessionValues == null)
            {
                customSessionValues = new Dictionary <string, string>();
            }
            if (customSessionValues.ContainsKey(sessionKey))
            {
                customSessionValues[sessionKey] = value;
            }
            else
            {
                customSessionValues.Add(sessionKey, value);
            }
            await sessionBagService.SetCustomSessionValues(customSessionValues);
        }