public ActionResult UpvoteVideo(int id) { if (Session["userId"] is null) { return(new ContentResult() { Content = "Not logged in" }); } Models.User user = new Models.User(); string usernameString = Session["userId"].ToString(); user.discriminator = int.Parse(usernameString.Split('-')[0]); user.username = usernameString.Split('-')[1]; Models.Video video = new Models.Video(); video.id = id; VideoBll videoBll = new VideoBll(); if (video.upvotes.Where(x => x.username == user.username && x.discriminator == user.discriminator).Count() == 0) { videoBll.CreateVideoUpvote(user, video); } else { return new ContentResult() { Content = "false" } }; return(new ContentResult() { Content = "true" }); }