using Microsoft.AspNetCore.Mvc;

namespace StateManagement.Views {
  public class SessionController : Controller {
    public IActionResult Index() {
      var session = HttpContext.Session;
      int counter = 1 + (session.GetInt32("Counter")??0);
      session.SetInt32("Counter", counter);
      ViewBag.Counter = counter;
      return View();
    }
  }
}
