public void AddThreadPost(int threadId, Post newPost)
        {
            // get thread by id
            // add post to context
            // add post to thread
            // save changes
            Thread targetThread = GetThreadById(threadId);

            context.Posts.Add(newPost);
            targetThread.AddPostToThread(newPost);
            context.SaveChanges();
        }
Exemple #2
0
        private static Thread BuildThread(int currentArrayIndex)
        {
            // build thread
            Thread thread = new Thread()
            {
                ThreadID = ObjectIDBuilder.GetThreadID(),
                Name     = threadNames[currentArrayIndex],
                Bio      = threadBios[currentArrayIndex],
                Category = threadCategories[currentArrayIndex]
            };

            thread.AddPostToThread(examplePost);

            return(thread);
        }