public ActionResult CommentLikeDetails(int id) { Models.Comment_Like theComment = database.Comment_Like.SingleOrDefault(c => c.comment_id == id); theComment.read = 1; database.SaveChanges(); return(RedirectToAction("LikeCommentIndex", new { id = theComment.comment_id })); }
public ActionResult UnLikeComment(int id) { Models.Comment_Like likeComment = database.Comment_Like.SingleOrDefault(p => p.comment_id == id); Models.Comment theComment = database.Comments.SingleOrDefault(p => p.comment_id == id); database.Comment_Like.Remove(likeComment); database.SaveChanges(); return(RedirectToAction("Index", new { id = theComment.picture_id })); }
public ActionResult LikeComment(int id) { // TODO: Add insert logic here int picture_id = int.Parse(Session["picture_id"].ToString()); Models.Picture thePicture = database.Pictures.SingleOrDefault(p => p.picture_id == picture_id); Models.Comment theComment = database.Comments.SingleOrDefault(c => c.comment_id == id); Models.Comment_Like likeComment = new Models.Comment_Like() { comment_id = theComment.comment_id, profile_id = thePicture.profile_id, timestamp = DateTime.Now, read = 0 }; database.Comment_Like.Add(likeComment); database.SaveChanges(); return(RedirectToAction("Index", new { id = theComment.picture_id })); }