Esempio n. 1
0
        private Discussion GetNecessaryDiscussionData(Discussion discussion)
        {
            if (discussion.DiscussionId < 0)
            {
                var unique = false;

                while (!unique)
                {
                    discussion.DiscussionId = rnd.Next(1, 100);

                    if (discussions.Exists(d => d.DiscussionId != discussion.DiscussionId))
                    {
                        unique = true;
                    }
                }
            }

            UserMemory um = new UserMemory();

            discussion.Submitter = um.GetSingle(discussion.Submitter.UserId);

            discussion.PostDT = DateTime.Now;

            return(discussion);
        }
Esempio n. 2
0
        private Comment CreateNecessaryCommentData(Comment comment)
        {
            if (comment.CommentId < 0)
            {
                var unique = false;

                while (!unique)
                {
                    comment.CommentId = rnd.Next(1, 100);

                    if (comments.Exists(d => d.CommentId != comment.CommentId))
                    {
                        unique = true;
                    }
                }
            }

            UserMemory um = new UserMemory();

            comment.Submitter = um.GetSingle(comment.Submitter.UserId);

            comment.PostDT = DateTime.Now;

            return(comment);
        }