示例#1
0
        public static IActionResult GetResult(CustomResponse r)
        {
            var expandoDict = (IDictionary <string, object>)r._expandoObject;
            var allValues   = expandoDict.Values.Where(x => x != null && !x.GetType().IsPrimitive);

            foreach (var value in allValues)
            {
                CheckForFormattedValues(value);
            }
            if (RequestHelper.IsApiCall(out bool withStoreMeta, out string[] metaTypes))
            {
                if (withStoreMeta)
                {
                    foreach (var metaType in metaTypes)
                    {
                        var metaObject = GlobalObject.ExecuteObject(metaType);
                        if (metaObject != null)
                        {
                            r.With(metaType, metaObject);
                        }
                    }
                }
                //ignore the view and return the model as json
                return(r._controller.Json(r._expandoObject));
            }
            if (r._viewName != null)
            {
                return(r._controller?.View(r._viewName, r._expandoObject));
            }
            return(r._controller?.View(r._expandoObject));
        }