Exemple #1
0
        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 <Post> driverPosts = await _postLogic.GetDriverPosts(DriverId);

            if (driverPosts.Count < 1)
            {
                TempData["Message"] = "There are no available drivers at this time";
            }
            return(View(driverPosts));
        }