public ForumPost GetPostWithThreads(int postId) { var efPostWithThread = UnitOfWork.ForumDiscussionPostRepository.GetPostWithThreads(postId); var postWithThread = ForumDiscussionPostConverter.ConvertFromCore(efPostWithThread); postWithThread.Threads = efPostWithThread.ForumDiscussionThreads .Select(thread => ForumDiscussionThreadConverter.ConvertFromCore(thread)) .ToList(); return(postWithThread); }
public bool AddPostThread(ForumThread postThread, User currentUser) { var threadToAdd = ForumDiscussionThreadConverter.ConvertToCore(postThread); threadToAdd.CreatedOn = DateTime.Now; threadToAdd.AddedBy = currentUser.UserId; UnitOfWork.ForumDiscussionThreadRepository.Add(threadToAdd); UnitOfWork.Commit(); if (threadToAdd.Id > 0) { postThread.AddedBy = currentUser.UserId; postThread.PostId = threadToAdd.PostId; postThread.AddedByUser = currentUser; new NotificationBl().AddNewDiscussionThreadNotification(postThread); } return(threadToAdd.Id > 0); }