public async Task <IActionResult> Create([Bind("PostId,PostStatusId,DriverId,VehicleId,Destination,Location,Date,Time")] Post post) { ViewBag.UserId = HttpContext.Session.GetInt32("UserId"); ViewBag.VehicleId = HttpContext.Session.GetInt32("VehicleId"); ViewBag.DriverId = HttpContext.Session.GetInt32("DriverId"); post.DriverId = ViewBag.DriverId; post.VehicleId = ViewBag.VehicleId; if (ModelState.IsValid) { _postLogic.CreatePost(post); await _postLogic.Save(); return(RedirectToAction(nameof(DriverIndex), new { driverId = post.DriverId })); } //ViewData["DriverId"] = new SelectList(_context.User, "UserId", "Email", post.DriverId); //ViewData["PostStatusId"] = new SelectList(_context.PostStatus, "PostStatusId", "PostStatusDescription", post.PostStatusId); //ViewData["VehicleId"] = new SelectList(_context.Vehicle, "VehicleId", "Make", post.VehicleId); return(View(post)); }