Learning the ASP MVC now, just my 3rd week on MVC
I did some tests on modeling pass, basically the controller just get the model, and pass into the view without doing an
You need to have getter and setter for ViewModel
in order to retrieve the values from posted form.
public class ViewModel
{
public string str1 { get; set; }
public string str2 { get; set; }
public List<int> list { get; set; }
}
You are showing us the POST-version of the method. Usually, the post action method would take the model, do some kind of processing (input validation, save to db, call a service, etc.), then if success, redirect to a different page.
You would usually only call the view from the POST action method if you have any problems with the inputs that require the user to fix.