Exemplo n.º 1
0
        // GET: Review/DriverIndex
        public async Task <IActionResult> DriverIndex(int?DriverId)
        {
            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"));
            }

            ViewBag.UserId      = HttpContext.Session.GetInt32("UserId");
            ViewBag.Username    = HttpContext.Session.GetString("Username");
            TempData["Message"] = null;

            List <Review> driverReviews = await _reviewLogic.GetDriverReviews(DriverId);

            if (driverReviews.Count < 1)
            {
                TempData["Message"] = "You have no reviews at this time";
            }
            return(View(driverReviews));
        }