Ejemplo n.º 1
0
        public ActionResult BindToChildViewModel(ModelBinderViewModel viewModel)
        {
            var json = JsonConvert.SerializeObject(viewModel, Formatting.Indented);

            Debugger.Break();
            return(this.Content(json));
        }
Ejemplo n.º 2
0
        // White list
        public ActionResult BindToViewModelInclude([Bind(Include = nameof(ModelBinderViewModel.Name))] ModelBinderViewModel viewModel)
        {
            var data = this.HttpContext.Request.Form;
            var json = JsonConvert.SerializeObject(viewModel, Formatting.Indented);

            Debugger.Break();
            return(this.Content(json));
        }
Ejemplo n.º 3
0
        public ActionResult BindToChild(ModelBinderViewModel viewModel)
        {
            if (this.ModelState.IsValid)
            {
                var json = JsonConvert.SerializeObject(viewModel, Formatting.Indented);
                return(this.Content(json));
            }

            return(this.View(viewModel));
        }
Ejemplo n.º 4
0
        public ActionResult JsonModelBinder([ModelBinder(typeof(JsonModelBinder))] ModelBinderViewModel viewModel)
        {
            if (this.ModelState.IsValid)
            {
                Debugger.Break();

                var json = JsonConvert.SerializeObject(viewModel, Formatting.Indented);
                return(this.Content(json));
            }

            return(this.View(this.HttpContext.Request.Form[nameof(JsonViewModel.Json)]));
        }
Ejemplo n.º 5
0
 public ActionResult BasicMappingForm(ModelBinderViewModel model)
 {
     return(this.Json(model));
 }