コード例 #1
0
        public async Task <Discussion> GetDiscussion(int discussionid)
        {
            Repository.Models.Discussion repoDiscussion = await _repo.GetDiscussion(discussionid);

            if (repoDiscussion == null)
            {
                Console.WriteLine("ForumLogic.GetDiscussion() was called for an invalid discussionid.");
                return(null);
            }

            // Get the topic associated with this discussion
            Repository.Models.Topic topic = _repo.GetDiscussionTopic(repoDiscussion.DiscussionId);
            if (topic == null)
            {
                topic           = new Repository.Models.Topic();
                topic.TopicName = "None";
            }
            Discussion discussion = Mapper.RepoDiscussionToDiscussion(repoDiscussion, topic);

            return(discussion);
        }