Ejemplo n.º 1
0
        static private void AddUser()
        {
            TopicDTO topic = new TopicDTO();

            topic.UsersID = currentUser.IDUser;

            Console.Write("Please enter Title: ");
            topic.Title = Console.ReadLine().ToString();

            Console.Write("Please enter Text:");
            topic.Text = Console.ReadLine().ToString();

            CommentDTO comment = new CommentDTO();

            Console.Write("Please enter Comment:");
            comment.CommentText = Console.ReadLine().ToString();
            comment.UsersID     = currentUser.IDUser;
            comment.CommentTime = DateTime.Now;

            commentDal.Add(comment);

            var comms = commentDal.Find(comment.CommentText);

            if (comms.Count == 0)
            {
                Console.WriteLine("error!");
            }
            else
            {
                topic.CommentID = comms[0].ID;
                Console.WriteLine(topic.CommentID.ToString());
                topicDal.Add(topic);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 添加评论
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public string AddComment(CommentModel model)
        {
            string check = CheckModel(model);

            if (ValidateHelper.IsPlumpString(check))
            {
                return(check);
            }
            var _commentDal = new CommentDal();
            var count       = _commentDal.Add(model);

            return(count > 0 ? SUCCESS : "评论失败");
        }
Ejemplo n.º 3
0
        protected void btnComment_Click(object sender, EventArgs e)
        {
            string date   = _date.ToString();
            string bookId = Request.QueryString["bookId"];

            _commentDal.Add(new Comment
            {
                NameSurname = tbxName.Text,
                Email       = tbxEmail.Text,
                Content     = tbxComment.Text,
                Title       = tbxTitle.Text,
                BookId      = int.Parse(bookId),
                Date        = date
            });
            GetBooksComments(bookId);
            CommentClear();
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public long Add(Comment model)
 {
     return(dal.Add(model));
 }