Beispiel #1
0
        public void FirstBatchTableJsonHandling()
        {
            var tags = new List <JArray>();

            tags.Add(JArray.Parse("[{'customer':'John Doe'},{'id': 33}]"));
            tags.Add(JArray.Parse("[{'customer':'SuperYo'},{'id': 34}]"));

            var properties = TinyJson.GetProperties(tags[0]);

            Assert.IsTrue(properties[0] == "customer");
            Assert.IsTrue(properties[1] == "id");

            var json = TinyJson.ToJson(tags, properties);
        }
        public async Task <IActionResult> Index(string userAgent)
        {
            if (string.IsNullOrEmpty(userAgent) && Request.Headers.ContainsKey("User-Agent"))
            {
                userAgent = Request.Headers["User-Agent"];
            }

            if (ConfirmEmailRequest())
            {
                await ConfirmEmail();
            }

            var content = GetContentByCulture();
            var isIE    = this.isIE(userAgent);

            ViewBag.content = content;
            ViewBag.isIE    = isIE;

            // Add polyfill scripts for IE browsers to support angular
            // More detail at: https://angular.io/guide/browser-support#polyfills-for-non-cli-users
            if (isIE)
            {
                ViewBag.polyfillScripts = new System.Collections.Generic.List <string>()
                {
                    "~/js/core-js/shim.min.js",
                    "~/js/web-animations.min.js"
                };
            }
            else
            {
                ViewBag.polyfillScripts = new System.Collections.Generic.List <string>(0);
            }

            var urlBase = this.Url.Content("~/");

            ViewBag.wowbookVendorScripts = TinyJson.SerializeObject(new string[] {
                $"{urlBase}{this.AddFileVersionToPath("dist/jquery.js")}",
                $"{urlBase}{this.AddFileVersionToPath("dist/wowbook.js")}"
            });

            ViewBag.pdfJsWorkerScript = TinyJson.SerializeObject($"{urlBase}{this.AddFileVersionToPath("dist/pdf.worker.min.js")}");

            // Get all countries is active
            ViewBag.countries = TinyJson.SerializeObject(this._countryServices.GetAll());
            // Get all sectors is active
            ViewBag.sectors = TinyJson.SerializeObject(this._sectorServices.GetAll());
            return(View());
        }
Beispiel #3
0
 public static string JsonSerialize(object obj)
 {
     return(TinyJson.SerializeObject(obj));
 }