'Redirect to action pass complex model

I want to pass to RedirectToAction model with List type property

For example, I have this simple model:

public class OrgToChooseFrom
    {
        public string OrgId { get; set; }
        public string FullName { get; set; }
    }

And complex model as this:

public class SelectCounteragentViewModel
    {
        public List<OrgToChooseFrom> Counteragents { get; set; }
        public OrgToChooseFrom SelectedOrg { get; set; }
    }

When I pass simple model with RedirectToAction every value is in place

        [HttpGet]
        public IActionResult ConfirmChoice(OrgToChooseFrom vm)
        {
            return View(vm);
        }

But when I try to pass complex model SelectCounteragentViewModel, there are empty list and null for the "SelectedOrg" field

        [HttpGet]
        public IActionResult SelectFromCAOrganizations(SelectCounteragentViewModel vm)
        {
            return View(vm);
        }

How can I do it?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source