Forgive me if this question seems trivial, but I am curious about the functionality and best practices involved. If the HomeController has a list as a field and one user adds to it, will that user see the updated list or will it remain empty?
Furthermore, how would this work with multiple users? Would each user have their own separate list?
I am inquiring because while I understand how to store data on the client side and in databases, I am interested in exploring server-side options for storing information within the MVC framework.
public List<int> Ids { get; set; }
public HomeController()
{
Ids = new List<int>();
}
public ContentResult AddToIds(int id)
{
Ids.Add(id);
return Content("Added");
}
public ContentResult GetIds()
{
return Content(Ids.Count.ToString());
}