public ActionResult Video(int id) { ViewBag.id = id; VideoBll videoBll = new VideoBll(); Models.VideoData video = videoBll.GetVideoDataById(id); if (id == null || id < 0 || video is null) { return(RedirectToAction("NotFound", "Home", new { message = "Could not find that video" })); } ViewBag.loggedin = 0; string usernameString = "0000-user"; if (Session["userId"] != null) { usernameString = Session["userId"].ToString(); ViewBag.loggedin = 1; } int discriminator = int.Parse(usernameString.Split('-')[0]); string username = usernameString.Split('-')[1]; if (video.upvotes.Where(x => x.username == username && x.discriminator == discriminator).Count() >= 1) { video.Upvoted = true; ViewBag.upvoted = 1; } else { video.Upvoted = false; ViewBag.upvoted = 0; } //CommentBll commentBll = new CommentBll(); //List<Models.Comment> comments = commentBll.GetCommentsByVideoId(int.Parse(id)); //ViewBag.Comments = commentBll.GetCommentsByVideoId(int.Parse(id)); //Models.VideoComments videoComments = new Models.VideoComments(); //videoComments.video = video; //videoComments.comments = comments; return(View(video)); }