Exemple #1
0
        public void CloseThread(string siteName, string forumId, string threadId)
        {
            // Check 1) get the site and check if it exists
            ISite site = GetSite(siteName);

            // Check 2) get the calling user             
            CallingUser callingUser = GetCallingUser(site);
            if (callingUser == null || callingUser.UserID == 0 || !callingUser.IsUserA(UserTypes.SuperUser))
            {
                throw new DnaWebProtocolException(ApiException.GetError(ErrorType.NotAuthorized));
            }

            try
            {
                int forumIdInt = Int32.Parse(forumId);
                int threadIdInt = Int32.Parse(threadId);
                ForumHelper forumHelper = new ForumHelper(readerCreator);

                forumHelper.CloseThreadWithCallingUser(site.SiteID, forumIdInt, threadIdInt, callingUser, siteList);
            }
            catch (ApiException ex)
            {
                throw new DnaWebProtocolException(ex);
            }
        }