public MessageWrapperFull GetProjectMessage(int messageid) { var discussion = EngineFactory.MessageEngine.GetByID(messageid).NotFoundIfNull(); var project = new ProjectWrapperFull(discussion.Project, EngineFactory.FileEngine.GetRoot(discussion.Project.ID)); var subscribers = GetProjectMessageSubscribers(messageid); var files = EngineFactory.MessageEngine.GetFiles(discussion).Select(x => new FileWrapper(x)); var comments = EngineFactory.CommentEngine.GetComments(discussion); return(new MessageWrapperFull(discussion, project, subscribers, files, comments.Where(r => r.Parent.Equals(Guid.Empty)).Select(x => GetCommentInfo(comments, x, discussion)).ToList())); }
public TaskWrapperFull GetTask(int taskid) { var task = EngineFactory.TaskEngine.GetByID(taskid).NotFoundIfNull(); var commentsCount = EngineFactory.CommentEngine.Count(task); var isSubscribed = EngineFactory.TaskEngine.IsSubscribed(task); var milestone = EngineFactory.MilestoneEngine.GetByID(task.Milestone, false); var timeSpend = EngineFactory.TimeTrackingEngine.GetByTask(task.ID).Sum(r => r.Hours); var project = new ProjectWrapperFull(task.Project, EngineFactory.FileEngine.GetRoot(task.Project.ID)); var files = EngineFactory.TaskEngine.GetFiles(task).Select(x => new FileWrapper(x)); var comments = EngineFactory.CommentEngine.GetComments(task); var filteredComments = comments.Where(r => r.Parent.Equals(Guid.Empty)).Select(x => GetCommentInfo(comments, x, task)).ToList(); return(new TaskWrapperFull(task, milestone, project, files, filteredComments, commentsCount, isSubscribed, timeSpend)); }