Esempio n. 1
0
      public IActionResult RandomNumber()
      {
          if (HttpContext.Session.GetString("View") != null && (HttpContext.Session.GetString("View")).CompareTo("Game/RandomNumber/Post") == 0)
          {
              ViewBag.Result          = HttpContext.Session.GetString("Result");
              ViewBag.UserGuess       = HttpContext.Session.GetInt32("UserGuess");
              ViewBag.GeneratedNumber = HttpContext.Session.GetInt32("RandomNumber");
          }

          int generatedNumber = GuessingGame.getRandomNum();

          HttpContext.Session.SetInt32("RandomNumber", generatedNumber);

          return(View());
      }