public Post InsertPost(int threadID, string content, out Thread thread) { var currentUser = System.Threading.Thread.CurrentPrincipal.Identity.Name; var post = new Post { ThreadID = threadID, Content = content, Created = DateTime.UtcNow, CreatedBy = currentUser }; Posts.Add(post); thread = Threads.Find(threadID); thread.LastPost = DateTime.UtcNow; thread.LastPostBy = currentUser; thread.PostCount++; SaveChanges(); return post; }
public static void PostAdded(Post post) { var hubContext = GlobalHost.ConnectionManager.GetHubContext<PostHub>(); hubContext.Clients.Group(ThreadHub.GetGroupNameForThread(post.ThreadID)).postAdded(post); }