public void ProcessRequest(HttpContext context) { string url = string.Empty; long anchorPostId = context.Request.QueryString.Get <long>("anchorPostId"); BarPostService barPostService = new BarPostService(); BarPost post = barPostService.Get(anchorPostId); if (post == null) { WebUtility.Return404(context); } IBarUrlGetter urlGetter = BarUrlGetterFactory.Get(post.TenantTypeId); if (post != null) { int?childPostIndex = 0; if (post.ParentId != 0) { childPostIndex = barPostService.GetPageIndexForChildrenPost(post.ParentId, post.PostId); } int pageIndex = barPostService.GetPageIndexForPostInThread(post.ThreadId, anchorPostId); url = urlGetter.ThreadDetail(post.ThreadId, pageIndex: pageIndex, anchorPostId: anchorPostId, childPostIndex: childPostIndex); } context.Response.RedirectPermanent(url); }
public AssociatedInfo GetAssociatedInfo(long associateId, string tenantTypeId = "") { BarThreadService barService = new BarThreadService(); BarThread barThread = new BarThreadService().Get(associateId); if (barThread != null) { IBarUrlGetter urlGetter = BarUrlGetterFactory.Get(barThread.TenantTypeId); return(new AssociatedInfo() { DetailUrl = urlGetter.ThreadDetail(barThread.ThreadId), Subject = barThread.Subject }); } return(null); }