Exemple #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);
            }
        }