Ejemplo n.º 1
0
        public static MyRequestContext SetQueryInfo(this MyRequestContext context, HttpRequest httpRequest)
        {
            var theGroup        = context.GetOrCreate(context.GetGroupName_QueryInfos());
            var queryCollection = httpRequest.Query;
            var keys            = queryCollection.Keys;

            foreach (var key in keys)
            {
                StringValues values;
                if (!queryCollection.TryGetValue(key, out values))
                {
                    theGroup.Items[key] = null;
                }
                else
                {
                    values = values.Where(x => !string.IsNullOrWhiteSpace(x)).ToArray();
                    foreach (var value in values)
                    {
                        //set by last one
                        theGroup.Items[key] = value;
                    }
                }
            }
            return(context);
        }
Ejemplo n.º 2
0
        public static MyQueryInfo GetQueryInfo(this MyRequestContext context)
        {
            var info     = new MyQueryInfo();
            var theGroup = context.GetOrCreate(context.GetGroupName_QueryInfos());

            theGroup.Items.SetProperties(info);
            return(info);
        }