Q:

How to add data into List in ASP.NET MVC 4.0?

I am new in MVC.
I have a class in Models like below.  
public class UserInfo
{
  public string Name{get;set;}
  public string Surname{get;set;}
}

And I have a controller like this.  
public class HomeController : Controller
    {
    //
    // GET: /Home/

    List<UserInfo> Users = new List<UserInfo>(); 
    public ActionResult Index()
    {
        return View();
    }

   public ActionResult Create()
    {
        return View();
    }

    [HttpPost]
    public ActionResult Create(UserInfo userInfo)
    {
        if (ModelState.IsValid)
        {
            Users.Add(userInfo);
            return RedirectToAction("Index");
        }
        return View();
    }

}

And every time when i press Create button in browser, it redirects to Index View. 
But List<UserInfo> is empty.  Why it happens? How to save data into List and show from grid or table from that List?

A:

Controllers are stateless.  A new instance is created each time you call an action, this is why your list is always empty.
If you want to persist the list between controller actions, you will need some sort of persistence mechanism - database, caching, etc.

A:

Make your list static
static List<UserInfo> Users = new List<UserInfo>(); 

