Ejemplo n.º 1
0
        public async Task <IActionResult> NewCategoryAndThreeItems(int categoryIndex)
        {
            var model = new ComplexViewModel
            {
                Categories = new[]
                {
                    new Category
                    {
                        Items = Enumerable.Range(0, 3)
                                .Select(i => new Item())
                                .ToArray(),
                    }
                }
            };

            var html = (await this.RenderViewAsync("CategoryView", model))
                       .Replace("Categories[0]",
                                $"Categories[{categoryIndex}]");

            return(Ok(html));
        }
Ejemplo n.º 2
0
        public IActionResult PostStyle3([FromBody] ComplexViewModel vm)
        {
            _contextAccessor.HttpContext.Session.SetString(_style3ViewModelKey, vm.ToJson());

            return(Ok(vm));
        }
Ejemplo n.º 3
0
        public IActionResult ShowStyle1(ComplexViewModel vm)
        {
            ViewBag.ReturnUrl = Url.Action("Style1");

            return(View("ComplexViewModel", vm));
        }