예제 #1
0
        internal Func <object> AddAntiforgeryToken(Func <object> func)
        {
            return(() =>
            {
                var data = func();

                var dict = JsonConvert.DeserializeObject <Dictionary <string, object> >(JsonConvert.SerializeObject(data));
                //var obj = JsonConvert.SerializeObject(dict, Formatting.Indented); -- no need

                dict.Add(AppConfig.ServiceApi.AntiforgeryTokenFieldName, CallContext.AntiforgeryTokenGenerate().RequestToken);
                return dict;
            });
        }