示例#1
0
        //retrieve comment time
        public string getCommentTime(int commentID)
        {
            comment c = new comment();

            c = wfDB.comments.Find(commentID);
            return(Convert.ToString(c.Timestamp));
        }
示例#2
0
        //retrieve comment text
        public string getCommentDesc(int commentID)
        {
            comment c = new comment();

            c = wfDB.comments.Find(commentID);
            return(c.Comment_Text);
        }
示例#3
0
        //retrieve comment rate
        public int getCommentRate(int commentID)
        {
            comment c = new comment();

            c = wfDB.comments.Find(commentID);
            return(Convert.ToInt32(c.Movie_Rate));
        }
示例#4
0
        //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");
            }
        }