public static Cart GetCart(System.IServiceProvider services)
        {
            Microsoft.AspNetCore.Http.ISession session = services.GetRequiredService <Microsoft.AspNetCore.Http.IHttpContextAccessor>()?.HttpContext.Session;
            SessionCart cart = session?.GetJson <SessionCart>("Cart") ?? new SessionCart();

            cart.Session = session;
            return(cart);
        }
Example #2
0
        public static string GetUniacID(this Microsoft.AspNetCore.Http.ISession session)
        {
            var jObj = GetWe7Data(session);

            if (jObj == null)
            {
                return(null);
            }
            return((string)jObj["uniacid"]);
        }
Example #3
0
        public static string GetUserName(this Microsoft.AspNetCore.Http.ISession session)
        {
            var jObj = session.GetWe7Data();

            if (jObj == null)
            {
                return(null);
            }
            return((string)jObj["username"]);
        }
Example #4
0
        public static JObject GetWe7Data(this Microsoft.AspNetCore.Http.ISession session)
        {
            JObject jObject = null;

            try
            {
                byte[] dataArray;
                session.TryGetValue(ConfigData.We7Config.We7DataSessionName, out dataArray);
                if (dataArray == null)
                {
                    return(null);
                }
                var json = Encoding.UTF8.GetString(dataArray);
                jObject = (JObject)JsonConvert.DeserializeObject(json);
            }
            catch (Exception)
            {
                //throw;
            }
            return(jObject);
        }
 public static void SetString(this Microsoft.AspNetCore.Http.ISession session, string key, string value)
 {
 }
 public static void SetInt32(this Microsoft.AspNetCore.Http.ISession session, string key, int value)
 {
 }
 public static string GetString(this Microsoft.AspNetCore.Http.ISession session, string key)
 {
     throw null;
 }
 public static int?GetInt32(this Microsoft.AspNetCore.Http.ISession session, string key)
 {
     throw null;
 }
Example #9
0
 public static void PushWe7Data(this Microsoft.AspNetCore.Http.ISession session, string data)
 {
     session.Set(ConfigData.We7Config.We7DataSessionName, Encoding.UTF8.GetBytes(data));
 }
Example #10
0
 public static bool HasWe7Data(this Microsoft.AspNetCore.Http.ISession session)
 {
     return(GetWe7Data(session) != null);
 }
Example #11
0
 public static System.Byte[] Get(this Microsoft.AspNetCore.Http.ISession session, string key) => throw null;
 public static System.Nullable <int> GetInt32(this Microsoft.AspNetCore.Http.ISession session, string key)
 {
     throw null;
 }