//retrieve comment time public string getCommentTime(int commentID) { comment c = new comment(); c = wfDB.comments.Find(commentID); return(Convert.ToString(c.Timestamp)); }
//retrieve comment text public string getCommentDesc(int commentID) { comment c = new comment(); c = wfDB.comments.Find(commentID); return(c.Comment_Text); }
//retrieve comment rate public int getCommentRate(int commentID) { comment c = new comment(); c = wfDB.comments.Find(commentID); return(Convert.ToInt32(c.Movie_Rate)); }
//retrieve commenters on comment public int getCommenter(int commentID) { comment c = new comment(); c = wfDB.comments.Find(commentID); return(Convert.ToInt32(c.UserID)); }
//create comment public string createComment(int userID, string comment_text, DateTime timestamp, int movie_ID, int rate) { comment newComment = new comment(); newComment.UserID = userID; newComment.Comment_Text = comment_text; newComment.Timestamp = timestamp; newComment.Movie_ID = movie_ID; newComment.Movie_Rate = rate; return(insertComment(newComment)); }
//insert comment public string insertComment(comment newComment) { try { wfDB.comments.Add(newComment); wfDB.SaveChanges(); //for every comment, there is a rating ThreadService ts = new ThreadService(); ts.updateMovieRate(Convert.ToInt32(newComment.Movie_ID)); //every activity is recorded activity(Convert.ToInt32(newComment.UserID), Convert.ToInt32(newComment.Movie_ID), newComment.Timestamp); return("Comment Added"); } catch { return("Comment Not Added"); } }