コード例 #1
0
    public static void WriteJson(this HttpResponse httpResponse, IQueryable filteredQuery, Func <IQueryable, List <object> > postFilter, bool process = true)
    {
        int                    total    = 0;
        IQueryable             fil      = process ? ExtJs4.Process(filteredQuery, ref total) : filteredQuery;
        JsonSerializerSettings settings = new JsonSerializerSettings
        {
            NullValueHandling = NullValueHandling.Ignore
        };

        httpResponse.Write(JsonConvert.SerializeObject(new { success = true, res = postFilter(fil), total = process ? total : filteredQuery.Count() }, Formatting.None, settings));
    }
コード例 #2
0
    public static void WriteJson(this HttpResponse httpResponse, IQueryable filteredQuery, bool process = true)
    {
        int total = 0;

        httpResponse.Write(JsonConvert.SerializeObject(new
        {
            success = true,
            res     = process ? ExtJs4.Process(filteredQuery, ref total) : filteredQuery,
            total   = process ? total : filteredQuery.Count(),
        }));
    }