Example #1
0
        public static TestJsonDotNetValueProviderFactoryModel LoadTestData(this TestJsonDotNetValueProviderFactoryModel model)
        {
            model.BoolProperty     = false;
            model.CharProperty     = char.Parse("A");
            model.DateTimeProperty = DateTime.MaxValue.ToString("yyyy/MM/dd");
            model.DecimalProperty  = decimal.MaxValue;
            model.FloatProperty    = float.MaxValue;
            model.IntProperty      = int.MaxValue;
            model.LongProperty     = long.MaxValue;
            model.ShortProperty    = short.MaxValue;
            model.StringProperty   = "StringProperty value";
            model.UintProperty     = uint.MaxValue;
            model.UlongProperty    = ulong.MaxValue;
            model.UshortProperty   = ushort.MaxValue;

            return(model);
        }
 public ActionResult Index(TestJsonDotNetValueProviderFactoryModel viewModel)
 {
     //Json ActionResult uses JavaScriptSerializer with the same limitation. Use Content result and JsonConvert.SerializeObject so we control the serialization.
     return Content(JsonConvert.SerializeObject(viewModel, Formatting.Indented, new JsonSerializerSettings() { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }), "application/json");
 }
 public ActionResult Index(TestJsonDotNetValueProviderFactoryModel viewModel)
 {
     return Json(viewModel);
 }