コード例 #1
0
 public IActionResult LoggedIn()
 {
     if (HttpContext.Session.GetInt32("id") > 0)
     {
         int?   thisid   = HttpContext.Session.GetInt32("id");
         string thisuser = HttpContext.Session.GetString("user");
         ViewBag.sessionid   = thisid;
         ViewBag.sessionuser = thisuser;
         ViewBag.ideas       = ideafactory.GetAllIdeas();
         return(View());
     }
     return(RedirectToAction("Index"));
 }
コード例 #2
0
 public IActionResult dashboard()
 {
     if (HttpContext.Session.GetInt32("currUser") == null || (int)HttpContext.Session.GetInt32("currUser") == 0)
     {
         return(RedirectToAction("Index"));
     }
     else
     {
         ViewBag.ideas        = ideaFactory.GetAllIdeas();
         ViewBag.currUser     = (int)HttpContext.Session.GetInt32("currUser");
         ViewBag.currUsername = HttpContext.Session.GetString("currUsername");
         return(View("dashboard"));
     }
 }