Exemplo n.º 1
0
        public TopicVM GetTopicVM(Guid topicId)
        {
            var     dbTopic  = GetTopic(topicId);
            TopicVM rtnTopic = new TopicVM();

            if (dbTopic != null)
            {
                var dbUserTopic = GetUserTopics(this.Actor.UserId, topicId).Select(ut => new UserTopicVM(ut)).FirstOrDefault();
                rtnTopic = new TopicVM(dbTopic, dbUserTopic);

                rtnTopic.Links           = this.mainContext.Links.Where(l => l.Active).Join(this.mainContext.TopicLinks.Where(tl => tl.TopicId == rtnTopic.TopicId && tl.Active), l => l.LinkId, tl => tl.LinkId, (l, tl) => l).OrderBy(l => l.Name).ToList();
                rtnTopic.Keywords        = this.mainContext.Keywords.Where(k => k.Active).Join(this.mainContext.TopicKeywords.Where(tk => tk.TopicId == rtnTopic.TopicId), k => k.KeywordId, tk => tk.KeywordId, (k, tk) => k).OrderBy(l => l.Name).ToList();
                rtnTopic.UserMentorships = MentorshipService.GetUserMentorships(this.Actor.UserId, topicId);

                if (dbUserTopic != null && rtnTopic.UserTopic.Status == TopicStatus.Mentor)
                {
                    rtnTopic.Mentorships = MentorshipService.OpenMentorships(this.Actor.UserId, topicId).Select(m => new MentorshipVM(m, null)).ToList();
                }
            }

            return(rtnTopic);
        }
Exemplo n.º 2
0
 public void SetupMentorships()
 {
     this.service = new MentorshipService(mockContext.Object, AdminUserVM);
 }