public IActionResult Events(Wedding w) { int?UserId = HttpContext.Session.GetInt32("UserId"); if (UserId == null) { return(Redirect("/")); } else { ViewBag.User = context.GetUserById((int)UserId); return(View()); } }