Пример #1
0
 public IActionResult Index(SampleParent model)
 {
     if (ModelState.IsValid)
     {
         // .. Save, debug here and see mappings correct in model
     }
     return(View(model));
 }
Пример #2
0
        public IActionResult Index()
        {
            var parent = new SampleParent
            {
                Name     = "Hello I am a Parent",
                Children = new List <SampleChild>
                {
                    new SampleChild {
                        Id = 1, Column1 = "Hello", Column2 = "I am ID 1", Column3 = 5, Column4 = DateTime.MinValue
                    },
                    new SampleChild {
                        Id = 2, Column1 = "I AM FROM THE FUTURE", Column2 = "hehe", Column3 = 999, Column4 = DateTime.MaxValue
                    },
                    new SampleChild {
                        Id = 4, Column1 = "OMG ID 4", Column2 = "Weeeee", Column3 = -50, Column4 = DateTime.Now
                    },
                }
            };

            return(View(parent));
        }