public async Task <IActionResult> PassengerIndex(int?PassengerId) { if (HttpContext.Session.GetInt32("UserId") == null || HttpContext.Session.GetInt32("UserId") == 0) { TempData["Message"] = "You must be logged in to access that page"; return(RedirectToAction("SignIn", "User")); } if (HttpContext.Session.GetInt32("PassengerId") == null || HttpContext.Session.GetInt32("PassengerId") == 0) { HttpContext.Session.SetInt32("PassengerId", Convert.ToInt32(PassengerId)); } else if (PassengerId == null) { PassengerId = HttpContext.Session.GetInt32("PassengerId"); } TempData["Message"] = null; ViewBag.UserId = HttpContext.Session.GetInt32("UserId"); ViewBag.Username = HttpContext.Session.GetString("Username"); ViewBag.PassengerId = HttpContext.Session.GetInt32("PassengerId"); List <Ride> passengerHistory = await _rideLogic.GetPassengerRides(PassengerId); if (passengerHistory.Count == 0) { TempData["Message"] = "You have no rides"; } return(View(passengerHistory)); }